Compare commits
119 Commits
ponychat-i
...
armageddon
Author | SHA1 | Date |
---|---|---|
Sam Dodrill | a99df1c02c | |
Sam Dodrill | 1ac5b0570e | |
Sam Dodrill | 63a50eaabc | |
Sam Dodrill | ee03711af4 | |
Sam Dodrill | e862c03515 | |
Sam Dodrill | 7cfa92c570 | |
Sam Dodrill | eda8b64bd6 | |
Sam Dodrill | 8ea110ad78 | |
Terence Tan | 79a3bf79ae | |
Sam Dodrill | 05b16194a3 | |
Sam Dodrill | cf6fdf5e76 | |
Sam Dodrill | 5ba9c76d22 | |
Hamcha | dd021e6449 | |
Hamcha | bd91ef662b | |
Sam Dodrill | 219934c7ce | |
Sam Dodrill | 1bb06bb3d0 | |
Sam Dodrill | cb1ff884a1 | |
Sam Dodrill | bfac4f3498 | |
Sam Dodrill | 095d9fdd1a | |
Apple Dash | 7d3966bc9b | |
Hamcha | b1bd65b6ab | |
Sam Dodrill | 46bf689e52 | |
Sam Dodrill | 22db314d25 | |
Sam Dodrill | 9890a48cd9 | |
Sam Dodrill | 4c0924c242 | |
Hamcha | 0cea0c17d2 | |
Sam Dodrill | 027b2310ca | |
Sam Dodrill | 923cda96ff | |
Sam Dodrill | 13221ce579 | |
Sam Dodrill | 379a56e808 | |
Sam Dodrill | e12b8a2631 | |
Sam Dodrill | 4810e6a8d4 | |
Jilles Tjoelker | 0ae1f793d9 | |
Rylee Fowler | e0489d0eec | |
AppleDash | 4d07bf5c59 | |
AppleDash | 47130005ae | |
Rylee Fowler | 26005c6f48 | |
Sam Dodrill | 6a55b37bd9 | |
Apple Dash | e05337fa2e | |
Sam Dodrill | 3c7006c286 | |
Sam Dodrill | fb096745d8 | |
Sam Dodrill | fdd6c2721a | |
Apple Dash | 263bc51300 | |
Sam Dodrill | 990a42b71b | |
Sam Dodrill | 19d656a29b | |
Sam Dodrill | d726cc83a2 | |
Sam Dodrill | 8036a22c25 | |
Sam Dodrill | 050ea2b809 | |
Sam Dodrill | 9a90d0d80e | |
Sam Dodrill | 2a8868cfe3 | |
Andrew Cook | b781b52396 | |
Sam Dodrill | 02b334ff8f | |
Sam Dodrill | ae6e4d3352 | |
Sam Dodrill | 6ccb7036db | |
Sam Dodrill | f31302d01d | |
Sam Dodrill | 685eed838a | |
Sam Dodrill | d23dc975b3 | |
Sam Dodrill | 4d941d3f49 | |
Sam Dodrill | 53c7dba717 | |
Sam Dodrill | 0953068ef0 | |
Sam Dodrill | f5945c6972 | |
Sam Dodrill | a5e296e4eb | |
Sam Dodrill | 1bd7b59879 | |
Sam Dodrill | 3a8780867a | |
Sam Dodrill | be813f8605 | |
Sam Dodrill | c649e42ae9 | |
Sam Dodrill | a7a510a504 | |
Sam Dodrill | 174c8b49b1 | |
Sam Dodrill | 0ebe9a5930 | |
Sam Dodrill | eceffbca02 | |
Sam Dodrill | 06bfe138d2 | |
Sam Dodrill | 20b066f6f4 | |
Sam Dodrill | 8f1d057a36 | |
Sam Dodrill | 74289701af | |
Sam Dodrill | 1a536989b2 | |
Sam Dodrill | 55147df5de | |
Sam Dodrill | 40249913ca | |
Sam Dodrill | 177241882c | |
Sam Dodrill | ba15f6d690 | |
Sam Dodrill | d4ea7f897e | |
Sam Dodrill | a3da200088 | |
Sam Dodrill | 6faf3c2a45 | |
Sam Dodrill | 3bf316e2dc | |
Sam Dodrill | 2e1fbf8292 | |
Sam Dodrill | c03f7b30c4 | |
Sam Dodrill | 80b3a83cbf | |
Sam Dodrill | 3cfbe05aff | |
Sam Dodrill | 2f35248278 | |
Sam Dodrill | 0785419045 | |
Sam Dodrill | 755b88c783 | |
Sam Dodrill | 8bff90d496 | |
Sam Dodrill | 5810ebb18f | |
Sam Dodrill | be2a7a772c | |
Sam Dodrill | b68f994db0 | |
Andrew Cook | 08879082d1 | |
Kyle Johnson | 77e149bf8b | |
Kyle Jonhson | 27b08207de | |
Sam Dodrill | 399b710cad | |
Kyle Jonhson | 502490b13a | |
Kyle Johnson | f9b84f1a58 | |
Sam Dodrill | 4939f6ee97 | |
Kyle Johnson | d64bf25497 | |
Kyle Johnson | 9d97f23c96 | |
Kyle Johnson | 14ed0de487 | |
Sam Dodrill | 31b7c1031a | |
Sam Dodrill | fd552b946a | |
Sam Dodrill | 4e6a065e62 | |
Sam Dodrill | 6da1d031e8 | |
Kyle Johnson | fe3c1c828e | |
Sam Dodrill | 8e1c8b7543 | |
Kyle Johnson | 6f979b5e43 | |
Sam Dodrill | a95cbf8021 | |
Sam Dodrill | e789385552 | |
Sam Dodrill | a37b75466f | |
Sam Dodrill | 57d74e150e | |
Kyle Johnson | 86a53b8ed7 | |
Sam Dodrill | dc6bed417c | |
Sam Dodrill | 94d6de727e | |
Alex Iadicicco | 68afaf72ac |
|
@ -0,0 +1,2 @@
|
|||
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'
|
|
@ -0,0 +1,12 @@
|
|||
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"
|
|
@ -0,0 +1,20 @@
|
|||
# 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.
|
||||
|
31
CREDITS
31
CREDITS
|
@ -1,13 +1,24 @@
|
|||
$Id: CREDITS 3133 2007-01-21 15:38:16Z jilles $
|
||||
|
||||
ponychat-ircd is a reboot of the ShadowIRCD project for use on PonyChat
|
||||
or other irc networks. We work with upstream charybdis and only apply
|
||||
patches that make sense for our use.
|
||||
|
||||
|
||||
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:
|
||||
|
||||
Niichan, Sam Dodrill <niichan -at- ponychat.net>
|
||||
|
||||
|
||||
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
|
||||
|
@ -52,5 +63,5 @@ ThaPrince, Jon Christopherson <jon -at- vile.com>
|
|||
twincest, River Tarnell <river -at- attenuate.org>
|
||||
w00t, Robin Burchell <surreal.w00t -at- gmail.com>
|
||||
|
||||
Visit the ShadowIRCd website at: http://www.shadowircd.net
|
||||
Visit us on IRC at: irc.thinstack.net #shadowircd
|
||||
Visit the elemental-ircd repo at: http://www.github.com/ponychat/elemental-ircd
|
||||
Visit us on IRC at: irc.ponychat.net #rainbow-factory
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
#!/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
|
|
@ -0,0 +1,22 @@
|
|||
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
|
37
FAQ
37
FAQ
|
@ -1,37 +0,0 @@
|
|||
ShadowIRCd FAQ
|
||||
--------------
|
||||
|
||||
Q: Why does ShadowIRCd not have remote includes?
|
||||
A: Remote Includes are a possible security risk due to possible MITM attacks
|
||||
and such and do not prevent server owners making changes that you do not
|
||||
want them to so they have little point. It is recommended to use rsync or
|
||||
a git/hg cron job to pull in remote configuration files.
|
||||
|
||||
Q: Does ShadowIRCd support Windows?
|
||||
A: No. There is no point in running IRCd on windows, aside perhaps as a quick
|
||||
testnet. If you feel like doing it anyway, the best thing to try would be
|
||||
some form of VM. We've heard that it doesn't compile on cygwin. We also
|
||||
have no interest in supporting windows in the future. If you're looking
|
||||
to start up an IRC network, you should really look into buying a VPS or
|
||||
shell from a decent provider.
|
||||
|
||||
Q: I want shun, m_invisible, unreal-style m_spy, saquit, etc!
|
||||
A: ShadowIRCd does not intend to ever implement such features. They have
|
||||
little to no legitimate use, amazing abuse potential, and are inferior to
|
||||
other methods. If for some reason you cannot live without such features,
|
||||
you should probably use another ircd.
|
||||
|
||||
Q: What services should I run with ShadowIRCd?
|
||||
A: The ShadowIRCd team highly recommends Atheme IRC Services (www.atheme.net),
|
||||
which is known to support ShadowIRCd properly and is a great services
|
||||
package overall. ShadowIRCd may work with Anope 1.8.x using the charybdis
|
||||
protocol module and 1.9.x using the ratbox protocol module, but it is not
|
||||
recommended and it has not been tested by the ShadowIRCd developers.
|
||||
|
||||
Q: I've got two servers linked and users on one are getting constant flood notices
|
||||
when trying to send to channels. HELP!!!!
|
||||
A: Has your server's clock gone backwards massively recently? (probably due to it
|
||||
being incorrect). If so, you have two options. You can either wait for the real
|
||||
time to be what the incorrect time was, or you can restart the affected server.
|
||||
If that does not fix the problem, please file a bug at:
|
||||
http://jira.atheme.org/browse/SHAD
|
|
@ -1,6 +0,0 @@
|
|||
The ShadowIRCd Stable GIT repository can be checked out using the following command:
|
||||
git clone git://git.atheme.org/unofficial/shadowircd-stable.git shadowircd-stable
|
||||
|
||||
ShadowIRCd's GIT repository depot can be browsed over the internet at
|
||||
the following address:
|
||||
http://git.atheme.org/unofficial/shadowircd-stable/
|
56
NEWS
56
NEWS
|
@ -1,6 +1,60 @@
|
|||
This is ponychat-ircd 6.5, Copyright (c) 2013 ponychat-ircd team.
|
||||
This is elemental-ircd 6.6.1, Copyright (c) 2014 elemental-ircd 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
|
||||
|
|
100
README.FIRST
100
README.FIRST
|
@ -1,100 +0,0 @@
|
|||
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" *
|
||||
* 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 **********************************
|
||||
|
||||
New Features - A short introduction:
|
||||
- Please see NEWS for more detailed changes.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
- A working parser/generator. bison is
|
||||
recommended on most platforms.
|
||||
|
||||
|
||||
Feature Specific Requirements:
|
||||
|
||||
- For SSL Clients, SSL Challenge controlled OPER feature, and encrypted server links,
|
||||
a working OpenSSL library
|
||||
|
||||
- For encrypted oper and (optional) server passwords, a working DES, MD5, or SHA library.
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
- To report bugs in ShadowIRCd, visit us at irc.thinstack.net #shadowircd
|
||||
|
||||
- See the INSTALL document for info on configuring and compiling
|
||||
ShadowIRCd.
|
||||
|
||||
- Please read doc/index.txt to get an overview of the current documentation.
|
||||
|
||||
- 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.
|
||||
|
||||
- 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 charybdis 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 6.x/7.x/8.x,
|
||||
Gentoo & Gentoo Hardened ~x86/~amd64/~fbsd
|
||||
Fedora 8/9 / CentOS 4/5 / Redhat Enterprise 5
|
||||
Debian Etch/Lenny/Squeeze,
|
||||
OpenSuSE 10/11,
|
||||
ArchLinux,
|
||||
OpenSolaris 2008.x?
|
||||
Solaris 10 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 6.x/7.x/8.x
|
||||
Linux glibc-2.6, glibc-2.7, glibc-2.8, glibc-2.10, glibc-2.11
|
||||
Solaris 2.6/7/8
|
||||
OpenBSD 2.8
|
||||
NetBSD 1.4
|
||||
OpenVMS/Alpha 7.2 (static modules, no ssld)
|
||||
|
||||
- Please read NEWS for information about what is in this release
|
||||
|
||||
- Other files recommended for reading: INSTALL
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
$Id$
|
50
README.md
50
README.md
|
@ -1,35 +1,35 @@
|
|||
# ponychat-ircd
|
||||
# Elemental-IRCd
|
||||
|
||||
Ponychat-ircd is a high performance, lightweight and scalable IRC daemon. It has
|
||||
its roots in ShadowIRCd and Charybdis and offers channel operators more options
|
||||
as well as for server administrators to have better separation of power and
|
||||
allows for easier management. It the preferred IRC daemon for PonyChat.
|
||||
**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
|
||||
|
||||
* Linux
|
||||
* Debian
|
||||
* Centos/Amazon Linux
|
||||
* Alpine Linux
|
||||
* FreeBSD
|
||||
All modern \*NIX systems should work. You need the equivalent of the following
|
||||
Debian packages:
|
||||
|
||||
## Build Directions
|
||||
- `libssl-dev`
|
||||
- `flex`
|
||||
- `bison`
|
||||
- `build-essential`
|
||||
|
||||
1. Ensure your system has the equivalents of `openssl-dev`, `flex`, `bison`,
|
||||
and the compiler toolkit.
|
||||
2. Download the [stable tarball](https://github.com/PonyChat/ponychat-ircd/archive/ponychat-ircd-6.3.4.tar.gz)
|
||||
and extract it somewhere on your system.
|
||||
3. `./configure --prefix=$HOME/ircd`
|
||||
4. `make`
|
||||
5. `make install`
|
||||
6. Copy the example config `example.conf` to `ircd.conf` in `~/ircd/etc`
|
||||
7. Edit the configuration to match your needs
|
||||
8. Run `bin/ircd` and have people connect up as normal
|
||||
```
|
||||
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
|
||||
|
||||
Our support channel is `#rainbow-factory` on `irc.ponychat.net`. If you like you
|
||||
can join us on our webchat [by clicking here](http://webchat.ponychat.net/?autojoin=%23#rainbow-factory).
|
||||
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.
|
||||
|
||||
Please note that running ponychat-ircd in weird or otherwise insane configurations
|
||||
may make us unable to help you.
|
||||
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.
|
||||
|
|
61
TODO
61
TODO
|
@ -1,61 +0,0 @@
|
|||
/ = 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...
|
||||
[x] merge m_join.c and m_sjoin.c in one module (same functions, done in ratbox3)
|
||||
[ ] 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
|
||||
[x] merge with libratbox SVN
|
||||
[x] 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)
|
||||
[x] tool for generating ssl certificates and other stuff
|
||||
[x] gnutls backend for at least SSL connections (replacing libcrypto use in m_challenge would be nice too)
|
||||
[x] merge some stuff from ircd-seven directly (to be determined what)
|
||||
[x] remote d:lines support
|
||||
[x] PASS selector:password for auth{} (useful for dynamic IPs)
|
||||
[ ] kline/xline/resv sync (what about spb's extension?)
|
||||
[x] drop non-TS6 (legacy protocol) support
|
||||
[?] Patch or core-feature - libguess on-fly any-charset-to-utf8 translation
|
||||
[x] module engine rework
|
||||
[?] MODULE_DEPEND and MODULE_CONFLICT for building extension dependencies (backport from shadowircd)
|
||||
[x] more beautiful way of adding new channel modes by module
|
||||
[x] basic functionality
|
||||
[x] some example modules
|
||||
[x] another idea is too make that work with privilege groups, like "serveradmins" or "ircops"
|
||||
[ ] 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
|
||||
[ ] auth checker module
|
||||
[ ] resolver module
|
||||
[x] privilege system for privilege groups, something like
|
||||
in .conf: helper { kill_global, rehash, kline_local }
|
||||
in modules: privilege_add("kill_global"), has_privilege(source_p, "kill_global") etc, should work the way dynamic cflags/umodes done
|
||||
-- this is done kinda like this, but not really. See HasPrivilege() calls. privilege_add() was not needed ~nenolod
|
||||
[x] Remove glines entirely
|
||||
[/] test suite as in ircu
|
||||
[?] win32
|
||||
[?] mingw support
|
||||
[R] win32 native support - VS doesn't follow C99, this will require us switching back to C89 with libratbox and (future) core
|
||||
[x] Bug fixes
|
||||
[x] Compilation without zlib headers fails - fixed
|
||||
[x] Compilation date and time in server welcome message is in OS locale - looks ugly 'cause often it's not match user's codepage
|
||||
[ ] Improvments
|
||||
[ ] ircd shouldn't need bison/byacc/yacc or flex for compilation
|
||||
--- other stuff
|
||||
[?] 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?)
|
||||
might be backported from shadowircd in future (chanroles planned)
|
||||
[?] somehow hide channel operators like ircnet can do?
|
||||
couldn't be done via extension currently - compilation-time option acceptable?
|
||||
[x] create chmode.h and put there all declarations of chm_* - this will make some modules clean
|
||||
[?] Move oper override server WALLOPS to global server notices?
|
|
@ -1,5 +0,0 @@
|
|||
TODO list for ShadowIRCd 7.0
|
||||
----------------------------
|
||||
* evaluate some of the more inane cmodes (D, E, N, etc) for possible removal.
|
||||
* move umode +B to extensions
|
||||
* evaluate old code and clean up / improve where improvement can be made
|
|
@ -0,0 +1,23 @@
|
|||
# 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
|
||||
|
345
bandb/bandb.c
345
bandb/bandb.c
|
@ -40,21 +40,20 @@
|
|||
|
||||
#define COMMIT_INTERVAL 3 /* seconds */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BANDB_KLINE,
|
||||
BANDB_DLINE,
|
||||
BANDB_XLINE,
|
||||
BANDB_RESV,
|
||||
LAST_BANDB_TYPE
|
||||
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'
|
||||
'K', 'D', 'X', 'R'
|
||||
};
|
||||
|
||||
static const char *bandb_table[LAST_BANDB_TYPE] = {
|
||||
"kline", "dline", "xline", "resv"
|
||||
"kline", "dline", "xline", "resv"
|
||||
};
|
||||
|
||||
|
||||
|
@ -66,191 +65,181 @@ static void check_schema(void);
|
|||
static void
|
||||
bandb_commit(void *unused)
|
||||
{
|
||||
rsdb_transaction(RSDB_TRANS_END);
|
||||
in_transaction = 0;
|
||||
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;
|
||||
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;
|
||||
if(type == BANDB_KLINE) {
|
||||
if(parc != 7)
|
||||
return;
|
||||
} else if(parc != 6)
|
||||
return;
|
||||
|
||||
mask1 = parv[para++];
|
||||
mask1 = parv[para++];
|
||||
|
||||
if(type == BANDB_KLINE)
|
||||
mask2 = parv[para++];
|
||||
if(type == BANDB_KLINE)
|
||||
mask2 = parv[para++];
|
||||
|
||||
oper = parv[para++];
|
||||
curtime = parv[para++];
|
||||
perm = parv[para++];
|
||||
reason = 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);
|
||||
}
|
||||
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);
|
||||
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;
|
||||
const char *mask1 = NULL;
|
||||
const char *mask2 = NULL;
|
||||
|
||||
if(type == BANDB_KLINE)
|
||||
{
|
||||
if(parc != 3)
|
||||
return;
|
||||
}
|
||||
else if(parc != 2)
|
||||
return;
|
||||
if(type == BANDB_KLINE) {
|
||||
if(parc != 3)
|
||||
return;
|
||||
} else if(parc != 2)
|
||||
return;
|
||||
|
||||
mask1 = parv[1];
|
||||
mask1 = parv[1];
|
||||
|
||||
if(type == BANDB_KLINE)
|
||||
mask2 = parv[2];
|
||||
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);
|
||||
}
|
||||
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 : "");
|
||||
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;
|
||||
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");
|
||||
/* 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(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)
|
||||
rb_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
|
||||
rb_snprintf(buf, sizeof(buf), "%c %s %s :%s",
|
||||
bandb_letter[i], table.row[j][0],
|
||||
table.row[j][2], table.row[j][3]);
|
||||
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);
|
||||
}
|
||||
rb_helper_write_queue(bandb_helper, "%s", buf);
|
||||
}
|
||||
|
||||
rsdb_exec_fetch_end(&table);
|
||||
}
|
||||
rsdb_exec_fetch_end(&table);
|
||||
}
|
||||
|
||||
rb_helper_write(bandb_helper, "F");
|
||||
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;
|
||||
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);
|
||||
while((len = rb_helper_read(helper, readbuf, sizeof(readbuf))) > 0) {
|
||||
parc = rb_string_to_array(readbuf, parv, MAXPARA);
|
||||
|
||||
if(parc < 1)
|
||||
continue;
|
||||
if(parc < 1)
|
||||
continue;
|
||||
|
||||
switch (parv[0][0])
|
||||
{
|
||||
case 'K':
|
||||
parse_ban(BANDB_KLINE, parv, parc);
|
||||
break;
|
||||
switch (parv[0][0]) {
|
||||
case 'K':
|
||||
parse_ban(BANDB_KLINE, parv, parc);
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
parse_ban(BANDB_DLINE, parv, parc);
|
||||
break;
|
||||
case 'D':
|
||||
parse_ban(BANDB_DLINE, parv, parc);
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
parse_ban(BANDB_XLINE, parv, parc);
|
||||
break;
|
||||
case 'X':
|
||||
parse_ban(BANDB_XLINE, parv, parc);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
parse_ban(BANDB_RESV, parv, parc);
|
||||
break;
|
||||
case 'R':
|
||||
parse_ban(BANDB_RESV, parv, parc);
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
parse_unban(BANDB_KLINE, parv, parc);
|
||||
break;
|
||||
case 'k':
|
||||
parse_unban(BANDB_KLINE, parv, parc);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
parse_unban(BANDB_DLINE, parv, parc);
|
||||
break;
|
||||
case 'd':
|
||||
parse_unban(BANDB_DLINE, parv, parc);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
parse_unban(BANDB_XLINE, parv, parc);
|
||||
break;
|
||||
case 'x':
|
||||
parse_unban(BANDB_XLINE, parv, parc);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
parse_unban(BANDB_RESV, parv, parc);
|
||||
break;
|
||||
case 'r':
|
||||
parse_unban(BANDB_RESV, parv, parc);
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
list_bans();
|
||||
break;
|
||||
default:
|
||||
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);
|
||||
if(in_transaction)
|
||||
rsdb_transaction(RSDB_TRANS_END);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifndef WINDOWS
|
||||
static void
|
||||
dummy_handler(int sig)
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -258,28 +247,28 @@ static void
|
|||
setup_signals()
|
||||
{
|
||||
#ifndef WINDOWS
|
||||
struct sigaction act;
|
||||
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);
|
||||
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);
|
||||
sigaddset(&act.sa_mask, SIGTRAP);
|
||||
#endif
|
||||
|
||||
#ifdef SIGWINCH
|
||||
sigaddset(&act.sa_mask, SIGWINCH);
|
||||
sigaction(SIGWINCH, &act, 0);
|
||||
sigaddset(&act.sa_mask, SIGWINCH);
|
||||
sigaction(SIGWINCH, &act, 0);
|
||||
#endif
|
||||
sigaction(SIGPIPE, &act, 0);
|
||||
sigaction(SIGPIPE, &act, 0);
|
||||
#ifdef SIGTRAP
|
||||
sigaction(SIGTRAP, &act, 0);
|
||||
sigaction(SIGTRAP, &act, 0);
|
||||
#endif
|
||||
|
||||
act.sa_handler = dummy_handler;
|
||||
sigaction(SIGALRM, &act, 0);
|
||||
act.sa_handler = dummy_handler;
|
||||
sigaction(SIGALRM, &act, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -287,51 +276,49 @@ setup_signals()
|
|||
static void
|
||||
db_error_cb(const char *errstr)
|
||||
{
|
||||
char buf[256];
|
||||
rb_snprintf(buf, sizeof(buf), "! :%s", errstr);
|
||||
rb_helper_write(bandb_helper, buf);
|
||||
rb_sleep(2 << 30, 0);
|
||||
exit(1);
|
||||
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);
|
||||
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;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
check_schema(void)
|
||||
{
|
||||
struct rsdb_table table;
|
||||
int i;
|
||||
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]);
|
||||
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);
|
||||
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]);
|
||||
}
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
|
1126
bandb/bantool.c
1126
bandb/bantool.c
File diff suppressed because it is too large
Load Diff
18
bandb/rsdb.h
18
bandb/rsdb.h
|
@ -6,19 +6,17 @@ typedef void rsdb_error_cb(const char *);
|
|||
|
||||
typedef int (*rsdb_callback) (int, const char **);
|
||||
|
||||
typedef enum rsdb_transtype
|
||||
{
|
||||
RSDB_TRANS_START,
|
||||
RSDB_TRANS_END
|
||||
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;
|
||||
struct rsdb_table {
|
||||
char ***row;
|
||||
int row_count;
|
||||
int col_count;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
int rsdb_init(rsdb_error_cb *);
|
||||
|
|
|
@ -39,206 +39,206 @@
|
|||
#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"
|
||||
"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"
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -274,328 +274,290 @@ NOTE: This function handles the following flags only:
|
|||
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;
|
||||
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++;
|
||||
while((ch = *format++) && (written < maxbytes)) {
|
||||
if(ch == '%') {
|
||||
/*
|
||||
* Advance past the %
|
||||
*/
|
||||
ch = *format++;
|
||||
|
||||
/*
|
||||
* Put the most common cases first - %s %d etc
|
||||
*/
|
||||
/*
|
||||
* Put the most common cases first - %s %d etc
|
||||
*/
|
||||
|
||||
if(ch == 's')
|
||||
{
|
||||
const char *str = va_arg(args, const char *);
|
||||
if(ch == 's') {
|
||||
const char *str = va_arg(args, const char *);
|
||||
|
||||
while((*dest = *str))
|
||||
{
|
||||
++dest;
|
||||
++str;
|
||||
while((*dest = *str)) {
|
||||
++dest;
|
||||
++str;
|
||||
|
||||
if(++written >= maxbytes)
|
||||
break;
|
||||
}
|
||||
if(++written >= maxbytes)
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if(ch == 'd')
|
||||
{
|
||||
int num = va_arg(args, int);
|
||||
int quotient;
|
||||
const char *str;
|
||||
char *digitptr = TempBuffer;
|
||||
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;
|
||||
}
|
||||
/*
|
||||
* We have to special-case "0" unfortunately
|
||||
*/
|
||||
if(num == 0) {
|
||||
*dest++ = '0';
|
||||
++written;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(num < 0)
|
||||
{
|
||||
*dest++ = '-';
|
||||
if(++written >= maxbytes)
|
||||
continue;
|
||||
if(num < 0) {
|
||||
*dest++ = '-';
|
||||
if(++written >= maxbytes)
|
||||
continue;
|
||||
|
||||
num = -num;
|
||||
}
|
||||
num = -num;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
quotient = num / TABLE_MAX;
|
||||
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.
|
||||
*/
|
||||
/*
|
||||
* 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)];
|
||||
str = IntTable[num - (quotient * TABLE_MAX)];
|
||||
|
||||
while((*digitptr = *str))
|
||||
{
|
||||
++digitptr;
|
||||
++str;
|
||||
}
|
||||
}
|
||||
while((num = quotient) != 0);
|
||||
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;
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
while(digitptr != TempBuffer) {
|
||||
*dest++ = *--digitptr;
|
||||
if(++written >= maxbytes)
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
} /* if (ch == 'd') */
|
||||
continue;
|
||||
} /* if (ch == 'd') */
|
||||
|
||||
if(ch == 'c')
|
||||
{
|
||||
*dest++ = va_arg(args, int);
|
||||
if(ch == 'c') {
|
||||
*dest++ = va_arg(args, int);
|
||||
|
||||
++written;
|
||||
++written;
|
||||
|
||||
continue;
|
||||
} /* if (ch == 'c') */
|
||||
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(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;
|
||||
}
|
||||
if(num == 0) {
|
||||
*dest++ = '0';
|
||||
++written;
|
||||
continue;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
quotient = num / TABLE_MAX;
|
||||
do {
|
||||
quotient = num / TABLE_MAX;
|
||||
|
||||
/*
|
||||
* Very similar to case 'd'
|
||||
*/
|
||||
/*
|
||||
* Very similar to case 'd'
|
||||
*/
|
||||
|
||||
str = IntTable[num - (quotient * TABLE_MAX)];
|
||||
str = IntTable[num - (quotient * TABLE_MAX)];
|
||||
|
||||
while((*digitptr = *str))
|
||||
{
|
||||
++digitptr;
|
||||
++str;
|
||||
}
|
||||
}
|
||||
while((num = quotient) != 0);
|
||||
while((*digitptr = *str)) {
|
||||
++digitptr;
|
||||
++str;
|
||||
}
|
||||
} while((num = quotient) != 0);
|
||||
|
||||
while(*(digitptr - 1) == '0')
|
||||
--digitptr;
|
||||
while(*(digitptr - 1) == '0')
|
||||
--digitptr;
|
||||
|
||||
while(digitptr != TempBuffer)
|
||||
{
|
||||
*dest++ = *--digitptr;
|
||||
if(++written >= maxbytes)
|
||||
break;
|
||||
}
|
||||
while(digitptr != TempBuffer) {
|
||||
*dest++ = *--digitptr;
|
||||
if(++written >= maxbytes)
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
} /* if (ch == 'u') */
|
||||
continue;
|
||||
} /* if (ch == 'u') */
|
||||
|
||||
if(ch == 'Q')
|
||||
{
|
||||
const char *arg = va_arg(args, const char *);
|
||||
if(ch == 'Q') {
|
||||
const char *arg = va_arg(args, const char *);
|
||||
|
||||
if(arg == NULL)
|
||||
continue;
|
||||
if(arg == NULL)
|
||||
continue;
|
||||
|
||||
const char *str = rsdb_quote(arg);
|
||||
const char *str = rsdb_quote(arg);
|
||||
|
||||
while((*dest = *str))
|
||||
{
|
||||
++dest;
|
||||
++str;
|
||||
while((*dest = *str)) {
|
||||
++dest;
|
||||
++str;
|
||||
|
||||
if(++written >= maxbytes)
|
||||
break;
|
||||
}
|
||||
if(++written >= maxbytes)
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if(ch == 'l')
|
||||
{
|
||||
if(*format == 'u')
|
||||
{
|
||||
unsigned long num = va_arg(args, unsigned long);
|
||||
unsigned long quotient;
|
||||
const char *str;
|
||||
char *digitptr = TempBuffer;
|
||||
if(ch == 'l') {
|
||||
if(*format == 'u') {
|
||||
unsigned long num = va_arg(args, unsigned long);
|
||||
unsigned long quotient;
|
||||
const char *str;
|
||||
char *digitptr = TempBuffer;
|
||||
|
||||
++format;
|
||||
++format;
|
||||
|
||||
if(num == 0)
|
||||
{
|
||||
*dest++ = '0';
|
||||
++written;
|
||||
continue;
|
||||
}
|
||||
if(num == 0) {
|
||||
*dest++ = '0';
|
||||
++written;
|
||||
continue;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
quotient = num / TABLE_MAX;
|
||||
do {
|
||||
quotient = num / TABLE_MAX;
|
||||
|
||||
/*
|
||||
* Very similar to case 'u'
|
||||
*/
|
||||
/*
|
||||
* Very similar to case 'u'
|
||||
*/
|
||||
|
||||
str = IntTable[num - (quotient * TABLE_MAX)];
|
||||
str = IntTable[num - (quotient * TABLE_MAX)];
|
||||
|
||||
while((*digitptr = *str))
|
||||
{
|
||||
++digitptr;
|
||||
++str;
|
||||
}
|
||||
}
|
||||
while((num = quotient) != 0);
|
||||
while((*digitptr = *str)) {
|
||||
++digitptr;
|
||||
++str;
|
||||
}
|
||||
} while((num = quotient) != 0);
|
||||
|
||||
while(*(digitptr - 1) == '0')
|
||||
--digitptr;
|
||||
while(*(digitptr - 1) == '0')
|
||||
--digitptr;
|
||||
|
||||
while(digitptr != TempBuffer)
|
||||
{
|
||||
*dest++ = *--digitptr;
|
||||
if(++written >= maxbytes)
|
||||
break;
|
||||
}
|
||||
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;
|
||||
continue;
|
||||
} else
|
||||
/* if (*format == 'u') */ if(*format == 'd') {
|
||||
long num = va_arg(args, long);
|
||||
long quotient;
|
||||
const char *str;
|
||||
char *digitptr = TempBuffer;
|
||||
|
||||
++format;
|
||||
++format;
|
||||
|
||||
if(num == 0)
|
||||
{
|
||||
*dest++ = '0';
|
||||
++written;
|
||||
continue;
|
||||
}
|
||||
if(num == 0) {
|
||||
*dest++ = '0';
|
||||
++written;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(num < 0)
|
||||
{
|
||||
*dest++ = '-';
|
||||
if(++written >= maxbytes)
|
||||
continue;
|
||||
if(num < 0) {
|
||||
*dest++ = '-';
|
||||
if(++written >= maxbytes)
|
||||
continue;
|
||||
|
||||
num = -num;
|
||||
}
|
||||
num = -num;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
quotient = num / TABLE_MAX;
|
||||
do {
|
||||
quotient = num / TABLE_MAX;
|
||||
|
||||
str = IntTable[num - (quotient * TABLE_MAX)];
|
||||
str = IntTable[num - (quotient * TABLE_MAX)];
|
||||
|
||||
while((*digitptr = *str))
|
||||
{
|
||||
++digitptr;
|
||||
++str;
|
||||
}
|
||||
}
|
||||
while((num = quotient) != 0);
|
||||
while((*digitptr = *str)) {
|
||||
++digitptr;
|
||||
++str;
|
||||
}
|
||||
} while((num = quotient) != 0);
|
||||
|
||||
while(*(digitptr - 1) == '0')
|
||||
--digitptr;
|
||||
while(*(digitptr - 1) == '0')
|
||||
--digitptr;
|
||||
|
||||
while(digitptr != TempBuffer)
|
||||
{
|
||||
*dest++ = *--digitptr;
|
||||
if(++written >= maxbytes)
|
||||
break;
|
||||
}
|
||||
while(digitptr != TempBuffer) {
|
||||
*dest++ = *--digitptr;
|
||||
if(++written >= maxbytes)
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else /* if (*format == 'd') */
|
||||
{
|
||||
/* XXX error */
|
||||
exit(1);
|
||||
}
|
||||
continue;
|
||||
} else { /* if (*format == 'd') */
|
||||
/* XXX error */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
} /* if (ch == 'l') */
|
||||
} /* if (ch == 'l') */
|
||||
|
||||
if(ch != '%')
|
||||
{
|
||||
/* XXX error */
|
||||
exit(1);
|
||||
} /* if (ch != '%') */
|
||||
} /* if (ch == '%') */
|
||||
if(ch != '%') {
|
||||
/* XXX error */
|
||||
exit(1);
|
||||
} /* if (ch != '%') */
|
||||
} /* if (ch == '%') */
|
||||
|
||||
*dest++ = ch;
|
||||
++written;
|
||||
} /* while ((ch = *format++) && (written < maxbytes)) */
|
||||
*dest++ = ch;
|
||||
++written;
|
||||
} /* while ((ch = *format++) && (written < maxbytes)) */
|
||||
|
||||
/*
|
||||
* Terminate the destination buffer with a \0
|
||||
*/
|
||||
*dest = '\0';
|
||||
/*
|
||||
* Terminate the destination buffer with a \0
|
||||
*/
|
||||
*dest = '\0';
|
||||
|
||||
return (written);
|
||||
return (written);
|
||||
} /* vSnprintf() */
|
||||
|
||||
/*
|
||||
|
@ -614,14 +576,14 @@ Return: number of characters copied, NOT including the terminating
|
|||
int
|
||||
rs_snprintf(char *dest, const size_t bytes, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int count;
|
||||
va_list args;
|
||||
int count;
|
||||
|
||||
va_start(args, format);
|
||||
va_start(args, format);
|
||||
|
||||
count = rs_vsnprintf(dest, bytes, format, args);
|
||||
count = rs_vsnprintf(dest, bytes, format, args);
|
||||
|
||||
va_end(args);
|
||||
va_end(args);
|
||||
|
||||
return (count);
|
||||
return (count);
|
||||
} /* Snprintf() */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* 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:
|
||||
|
@ -27,7 +27,7 @@
|
|||
* 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"
|
||||
|
@ -41,224 +41,206 @@ 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);
|
||||
rb_vsnprintf(buf, sizeof(buf), errstr, ap);
|
||||
va_end(ap);
|
||||
error_cb(buf);
|
||||
}
|
||||
else
|
||||
exit(1);
|
||||
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;
|
||||
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");
|
||||
/* 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(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)
|
||||
{
|
||||
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",
|
||||
sqlite3_errmsg(rb_bandb));
|
||||
mlog(errbuf);
|
||||
return -1;
|
||||
}
|
||||
if(access(dbpath, W_OK))
|
||||
{
|
||||
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno));
|
||||
mlog(errbuf);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
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);
|
||||
if(rb_bandb)
|
||||
sqlite3_close(rb_bandb);
|
||||
}
|
||||
|
||||
const char *
|
||||
rsdb_quote(const char *src)
|
||||
{
|
||||
static char buf[BUFSIZE * 4];
|
||||
char *p = buf;
|
||||
static char buf[BUFSIZE * 4];
|
||||
char *p = buf;
|
||||
|
||||
/* cheap and dirty length check.. */
|
||||
if(strlen(src) >= (sizeof(buf) / 2))
|
||||
return NULL;
|
||||
/* cheap and dirty length check.. */
|
||||
if(strlen(src) >= (sizeof(buf) / 2))
|
||||
return NULL;
|
||||
|
||||
while(*src)
|
||||
{
|
||||
if(*src == '\'')
|
||||
*p++ = '\'';
|
||||
while(*src) {
|
||||
if(*src == '\'')
|
||||
*p++ = '\'';
|
||||
|
||||
*p++ = *src++;
|
||||
}
|
||||
*p++ = *src++;
|
||||
}
|
||||
|
||||
*p = '\0';
|
||||
return buf;
|
||||
*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;
|
||||
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;
|
||||
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);
|
||||
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 >= 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;
|
||||
}
|
||||
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;
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
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);
|
||||
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 >= 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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
if(success)
|
||||
break;
|
||||
|
||||
mlog("fatal error: problem with db file: %s", errmsg);
|
||||
break;
|
||||
mlog("fatal error: problem with db file: %s", errmsg);
|
||||
break;
|
||||
|
||||
default:
|
||||
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;
|
||||
/* we need to be able to free data afterward */
|
||||
table->arg = data;
|
||||
|
||||
if(table->row_count == 0)
|
||||
{
|
||||
table->row = NULL;
|
||||
return;
|
||||
}
|
||||
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);
|
||||
/* 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++];
|
||||
}
|
||||
}
|
||||
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;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < table->row_count; i++)
|
||||
{
|
||||
rb_free(table->row[i]);
|
||||
}
|
||||
rb_free(table->row);
|
||||
for(i = 0; i < table->row_count; i++) {
|
||||
rb_free(table->row[i]);
|
||||
}
|
||||
rb_free(table->row);
|
||||
|
||||
sqlite3_free_table((char **)table->arg);
|
||||
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");
|
||||
if(type == RSDB_TRANS_START)
|
||||
rsdb_exec(NULL, "BEGIN TRANSACTION");
|
||||
else if(type == RSDB_TRANS_END)
|
||||
rsdb_exec(NULL, "COMMIT TRANSACTION");
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for ponychat-ircd 6.5.1.
|
||||
# Generated by GNU Autoconf 2.69 for elemental-ircd 6.6.1.
|
||||
#
|
||||
# $Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $
|
||||
# 2014 elemental-ircd Team
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
|
||||
|
@ -577,10 +577,10 @@ MFLAGS=
|
|||
MAKEFLAGS=
|
||||
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='ponychat-ircd'
|
||||
PACKAGE_TARNAME='ponychat-ircd'
|
||||
PACKAGE_VERSION='6.5.1'
|
||||
PACKAGE_STRING='ponychat-ircd 6.5.1'
|
||||
PACKAGE_NAME='elemental-ircd'
|
||||
PACKAGE_TARNAME='elemental-ircd'
|
||||
PACKAGE_VERSION='6.6.1'
|
||||
PACKAGE_STRING='elemental-ircd 6.6.1'
|
||||
PACKAGE_BUGREPORT=''
|
||||
PACKAGE_URL=''
|
||||
|
||||
|
@ -1303,7 +1303,7 @@ if test "$ac_init_help" = "long"; then
|
|||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures ponychat-ircd 6.5.1 to adapt to many kinds of systems.
|
||||
\`configure' configures elemental-ircd 6.6.1 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
@ -1351,7 +1351,7 @@ Fine tuning of the installation directories:
|
|||
--infodir=DIR info documentation [DATAROOTDIR/info]
|
||||
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
|
||||
--mandir=DIR man documentation [DATAROOTDIR/man]
|
||||
--docdir=DIR documentation root [DATAROOTDIR/doc/ponychat-ircd]
|
||||
--docdir=DIR documentation root [DATAROOTDIR/doc/elemental-ircd]
|
||||
--htmldir=DIR html documentation [DOCDIR]
|
||||
--dvidir=DIR dvi documentation [DOCDIR]
|
||||
--pdfdir=DIR pdf documentation [DOCDIR]
|
||||
|
@ -1364,7 +1364,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of ponychat-ircd 6.5.1:";;
|
||||
short | recursive ) echo "Configuration of elemental-ircd 6.6.1:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
@ -1488,14 +1488,14 @@ fi
|
|||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
ponychat-ircd configure 6.5.1
|
||||
elemental-ircd configure 6.6.1
|
||||
generated by GNU Autoconf 2.69
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
This configure script is free software; the Free Software Foundation
|
||||
gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
$Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $
|
||||
2014 elemental-ircd Team
|
||||
_ACEOF
|
||||
exit
|
||||
fi
|
||||
|
@ -2092,7 +2092,7 @@ cat >config.log <<_ACEOF
|
|||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by ponychat-ircd $as_me 6.5.1, which was
|
||||
It was created by elemental-ircd $as_me 6.6.1, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
|
@ -10100,7 +10100,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by ponychat-ircd $as_me 6.5.1, which was
|
||||
This file was extended by elemental-ircd $as_me 6.6.1, which was
|
||||
generated by GNU Autoconf 2.69. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
@ -10166,7 +10166,7 @@ _ACEOF
|
|||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
ponychat-ircd config.status 6.5.1
|
||||
elemental-ircd config.status 6.6.1
|
||||
configured by $0, generated by GNU Autoconf 2.69,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
@ -11066,5 +11066,5 @@ Configuration:
|
|||
Nickname length : $NICKLEN
|
||||
Topic length : $TOPICLEN
|
||||
|
||||
Use (g)make to compile ponychat-ircd, then (g)make install to install it.
|
||||
Use (g)make to compile elemental-ircd, then (g)make install to install it.
|
||||
"
|
||||
|
|
|
@ -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([$Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $])
|
||||
AC_COPYRIGHT([2014 elemental-ircd Team])
|
||||
|
||||
AC_INIT([ponychat-ircd],[6.5.1])
|
||||
AC_INIT([elemental-ircd],[6.6.1])
|
||||
|
||||
AC_CONFIG_HEADER(include/setup.h)
|
||||
|
||||
|
@ -253,7 +253,7 @@ AC_SUBST([pkglibdir])
|
|||
AC_SUBST([rundir])
|
||||
AC_SUBST([pkgrundir])
|
||||
AC_SUBST([pkglocalstatedir])
|
||||
AC_DEFINE_DIR([PKGLOCALSTATEDIR], [pkglocalstatedir], [[Directory in which to store state, such as band database]])
|
||||
AC_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])
|
||||
|
||||
|
@ -1240,5 +1240,5 @@ Configuration:
|
|||
Nickname length : $NICKLEN
|
||||
Topic length : $TOPICLEN
|
||||
|
||||
Use (g)make to compile ponychat-ircd, then (g)make install to install it.
|
||||
Use (g)make to compile elemental-ircd, then (g)make install to install it.
|
||||
"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* 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 $
|
||||
*
|
||||
|
@ -47,10 +48,10 @@ loadmodule "extensions/sno_globaloper.so";
|
|||
#loadmodule "extensions/sno_whois.so";
|
||||
|
||||
serverinfo {
|
||||
name = "hades.arpa";
|
||||
name = "hostname.domain.tld";
|
||||
sid = "42X";
|
||||
description = "shadowircd test server";
|
||||
network_name = "AthemeNET";
|
||||
description = "elemental-ircd test server";
|
||||
network_name = "ShadowNET";
|
||||
network_desc = "Your IRC network.";
|
||||
helpchan = "#help";
|
||||
helpurl = "http://www.mynet.net/help";
|
||||
|
@ -62,7 +63,7 @@ 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";
|
||||
|
||||
|
@ -90,7 +91,7 @@ serverinfo {
|
|||
|
||||
admin {
|
||||
name = "Lazy admin (lazya)";
|
||||
description = "AthemeNET client server";
|
||||
description = "ShadowNET client server";
|
||||
email = "nobody@127.0.0.1";
|
||||
};
|
||||
|
||||
|
@ -139,7 +140,8 @@ 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.
|
||||
* otherwise, you probably want to leave it on. Disabling this will not
|
||||
* update on a rehash.
|
||||
*/
|
||||
defer_accept = yes;
|
||||
|
||||
|
@ -152,8 +154,8 @@ listen {
|
|||
|
||||
/* 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:)
|
||||
|
@ -185,7 +187,7 @@ auth {
|
|||
* 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)
|
||||
|
@ -198,13 +200,8 @@ auth {
|
|||
*/
|
||||
autojoin = "#shadowircd,#test";
|
||||
|
||||
/* autojoin_opers : Channel (or channels, comma-seperated) to join
|
||||
* opers to on oper-up.
|
||||
*/
|
||||
autojoin_opers = "#opers,#help";
|
||||
|
||||
/* 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
|
||||
|
@ -215,15 +212,15 @@ 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";
|
||||
};
|
||||
|
@ -284,13 +281,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";
|
||||
|
@ -397,14 +394,14 @@ channel {
|
|||
exemptchanops = "NT";
|
||||
use_halfop = yes;
|
||||
use_admin = yes;
|
||||
use_owner = yes;
|
||||
use_owner = yes;
|
||||
use_knock = yes;
|
||||
use_local_channels = 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;
|
||||
|
@ -430,7 +427,7 @@ serverhide {
|
|||
* They are used in pairs of one host/rejection reason.
|
||||
*
|
||||
* These settings should be adequate for most networks, and are (presently)
|
||||
* required for use on AthemeNet.
|
||||
* required for use on ShadowNet.
|
||||
*
|
||||
* Word to the wise: Do not use blacklists like SPEWS for blocking IRC
|
||||
* connections.
|
||||
|
@ -444,9 +441,6 @@ 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";
|
||||
|
@ -455,11 +449,8 @@ blacklist {
|
|||
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.";
|
||||
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.";
|
||||
};
|
||||
|
||||
alias "NickServ" {
|
||||
|
@ -540,23 +531,23 @@ general {
|
|||
|
||||
default_operstring = "is an IRC Operator";
|
||||
default_adminstring = "is a Server Administrator";
|
||||
default_operhost = "staff.testnet.net";
|
||||
#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;
|
||||
anti_spam_exit_message_time = 5 minutes;
|
||||
use_part_messages = yes;
|
||||
ts_warn_delta = 30 seconds;
|
||||
ts_max_delta = 5 minutes;
|
||||
|
@ -580,7 +571,7 @@ 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;
|
||||
|
@ -596,11 +587,11 @@ general {
|
|||
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;
|
||||
|
@ -608,7 +599,7 @@ general {
|
|||
throttle_duration = 60;
|
||||
throttle_count = 4;
|
||||
expire_override_time = 5 minutes;
|
||||
away_interval = 30;
|
||||
away_interval = 30;
|
||||
};
|
||||
|
||||
modules {
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
This is ShadowIRCd MOTD. You might replace it, but if not, your friends will
|
||||
laugh at you.
|
||||
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.
|
||||
|
|
|
@ -373,11 +373,6 @@ auth {
|
|||
*/
|
||||
autojoin = "#shadowircd,#test";
|
||||
|
||||
/* autojoin_opers : Channel (or channels, comma-seperated) to join
|
||||
* opers to on oper-up.
|
||||
*/
|
||||
autojoin_opers = "#opers,#help";
|
||||
|
||||
/* Possible flags in auth:
|
||||
*
|
||||
* encrypted | password is encrypted with mkpasswd
|
||||
|
@ -967,9 +962,6 @@ 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";
|
||||
|
@ -977,12 +969,6 @@ blacklist {
|
|||
|
||||
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.";
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -376,11 +376,6 @@ auth {
|
|||
*/
|
||||
autojoin = "#shadowircd,#test";
|
||||
|
||||
/* autojoin_opers : Channel (or channels, comma-seperated) to join
|
||||
* opers to on oper-up.
|
||||
*/
|
||||
autojoin_opers = "#opers,#help";
|
||||
|
||||
/* Possible flags in auth:
|
||||
*
|
||||
* encrypted | password is encrypted with mkpasswd
|
||||
|
@ -970,9 +965,6 @@ 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";
|
||||
|
@ -980,12 +972,6 @@ blacklist {
|
|||
|
||||
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.";
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
## 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.
|
||||
|
|
@ -53,6 +53,7 @@ SRCS = \
|
|||
force_user_invis.c \
|
||||
hurt.c \
|
||||
ip_cloaking.c \
|
||||
ip_cloaking-5.c \
|
||||
sno_farconnect.c \
|
||||
sno_globalkline.c \
|
||||
sno_globaloper.c \
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
static void h_can_join(hook_data_channel *);
|
||||
|
||||
mapi_hfn_list_av1 adminonly_hfnlist[] = {
|
||||
{ "can_join", (hookfn) h_can_join },
|
||||
{ NULL, NULL }
|
||||
{ "can_join", (hookfn) h_can_join },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static unsigned int mymode;
|
||||
|
@ -22,17 +22,17 @@ static unsigned int mymode;
|
|||
static int
|
||||
_modinit(void)
|
||||
{
|
||||
mymode = cflag_add('A', chm_staff);
|
||||
if (mymode == 0)
|
||||
return -1;
|
||||
mymode = cflag_add('A', chm_staff);
|
||||
if (mymode == 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_moddeinit(void)
|
||||
{
|
||||
cflag_orphan('A');
|
||||
cflag_orphan('A');
|
||||
}
|
||||
|
||||
DECLARE_MODULE_AV1(chm_adminonly, _modinit, _moddeinit, NULL, NULL, adminonly_hfnlist, "$Revision$");
|
||||
|
@ -40,12 +40,12 @@ DECLARE_MODULE_AV1(chm_adminonly, _modinit, _moddeinit, NULL, NULL, adminonly_hf
|
|||
static void
|
||||
h_can_join(hook_data_channel *data)
|
||||
{
|
||||
struct Client *source_p = data->client;
|
||||
struct Channel *chptr = data->chptr;
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
static void h_can_join(hook_data_channel *);
|
||||
|
||||
mapi_hfn_list_av1 operonly_hfnlist[] = {
|
||||
{ "can_join", (hookfn) h_can_join },
|
||||
{ NULL, NULL }
|
||||
{ "can_join", (hookfn) h_can_join },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static unsigned int mymode;
|
||||
|
@ -26,18 +26,18 @@ static unsigned int mymode;
|
|||
static int
|
||||
_modinit(void)
|
||||
{
|
||||
mymode = cflag_add('O', chm_staff);
|
||||
if (mymode == 0)
|
||||
return -1;
|
||||
mymode = cflag_add('O', chm_staff);
|
||||
if (mymode == 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_moddeinit(void)
|
||||
{
|
||||
cflag_orphan('O');
|
||||
cflag_orphan('O');
|
||||
}
|
||||
|
||||
DECLARE_MODULE_AV1(chm_operonly, _modinit, _moddeinit, NULL, NULL, operonly_hfnlist, "$Revision$");
|
||||
|
@ -45,12 +45,12 @@ DECLARE_MODULE_AV1(chm_operonly, _modinit, _moddeinit, NULL, NULL, operonly_hfnl
|
|||
static void
|
||||
h_can_join(hook_data_channel *data)
|
||||
{
|
||||
struct Client *source_p = data->client;
|
||||
struct Channel *chptr = data->chptr;
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
static void h_can_join(hook_data_channel *);
|
||||
|
||||
mapi_hfn_list_av1 sslonly_hfnlist[] = {
|
||||
{ "can_join", (hookfn) h_can_join },
|
||||
{ NULL, NULL }
|
||||
{ "can_join", (hookfn) h_can_join },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static unsigned int mymode;
|
||||
|
@ -22,18 +22,18 @@ static unsigned int mymode;
|
|||
static int
|
||||
_modinit(void)
|
||||
{
|
||||
mymode = cflag_add('S', chm_simple);
|
||||
if (mymode == 0)
|
||||
return -1;
|
||||
mymode = cflag_add('S', chm_simple);
|
||||
if (mymode == 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_moddeinit(void)
|
||||
{
|
||||
cflag_orphan('S');
|
||||
cflag_orphan('S');
|
||||
}
|
||||
|
||||
DECLARE_MODULE_AV1(chm_sslonly, _modinit, _moddeinit, NULL, NULL, sslonly_hfnlist, "$Revision$");
|
||||
|
@ -41,12 +41,12 @@ DECLARE_MODULE_AV1(chm_sslonly, _modinit, _moddeinit, NULL, NULL, sslonly_hfnlis
|
|||
static void
|
||||
h_can_join(hook_data_channel *data)
|
||||
{
|
||||
struct Client *source_p = data->client;
|
||||
struct Channel *chptr = data->chptr;
|
||||
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 could join this channel!");
|
||||
data->approved = ERR_CUSTOM;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -20,8 +20,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 +29,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;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,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,11 +29,10 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,25 +47,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 +93,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,44 +106,44 @@ 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. */
|
||||
|
||||
|
@ -159,19 +159,16 @@ 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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -181,19 +178,16 @@ munreg_test(struct Client *client_p, struct Client *source_p, int parc, const ch
|
|||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -203,15 +197,12 @@ mclient_test(struct Client *client_p, struct Client *source_p, int parc, const c
|
|||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -221,15 +212,12 @@ mrclient_test(struct Client *client_p, struct Client *source_p, int parc, const
|
|||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -239,21 +227,18 @@ mserver_test(struct Client *client_p, struct Client *source_p, int parc, const c
|
|||
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 */
|
||||
|
|
|
@ -18,25 +18,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;
|
||||
}
|
||||
|
|
|
@ -21,46 +21,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;
|
||||
}
|
||||
|
|
|
@ -20,34 +20,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;
|
||||
}
|
||||
|
|
|
@ -19,40 +19,39 @@ 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;
|
||||
|
||||
rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
|
||||
client_p->name, client_p->username, client_p->host, client_p->info);
|
||||
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))
|
||||
{
|
||||
rb_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)) {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -18,26 +18,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;
|
||||
}
|
||||
|
|
|
@ -18,26 +18,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;
|
||||
}
|
||||
|
|
|
@ -18,26 +18,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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,25 +23,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 +82,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 +135,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,16 +150,15 @@ 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);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -170,84 +169,79 @@ 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;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -261,32 +255,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;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -298,88 +292,76 @@ 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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -390,20 +372,18 @@ 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");
|
||||
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);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -411,19 +391,17 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -435,10 +413,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);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -446,17 +424,16 @@ 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)) {
|
||||
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.");
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -464,47 +441,43 @@ 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, "", "");
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -518,18 +491,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);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -537,15 +510,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;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -553,85 +526,80 @@ 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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -643,14 +611,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;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Charybdis: an advanced ircd
|
||||
* ip_cloaking.c: provide user hostname cloaking
|
||||
*
|
||||
|
@ -20,206 +20,191 @@
|
|||
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['x'] = 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['x'] = 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)
|
||||
{
|
||||
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 (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);
|
||||
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");
|
||||
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);
|
||||
if (newhost != client_p->orighost)
|
||||
SetDynSpoof(client_p);
|
||||
else
|
||||
ClearDynSpoof(client_p);
|
||||
}
|
||||
|
||||
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;
|
||||
/* 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;
|
||||
|
||||
rb_strlcpy(outbuf, inbuf, HOSTLEN + 1);
|
||||
rb_strlcpy(outbuf, inbuf, HOSTLEN + 1);
|
||||
|
||||
if (strchr(outbuf, ':'))
|
||||
{
|
||||
ipv6 = 1;
|
||||
if (strchr(outbuf, ':')) {
|
||||
ipv6 = 1;
|
||||
|
||||
/* 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;
|
||||
/* 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;
|
||||
|
||||
for (tptr = outbuf; *tptr != '\0'; tptr++)
|
||||
{
|
||||
if (*tptr == ':' || *tptr == '.')
|
||||
{
|
||||
sepcount++;
|
||||
continue;
|
||||
}
|
||||
for (tptr = outbuf; *tptr != '\0'; tptr++) {
|
||||
if (*tptr == ':' || *tptr == '.') {
|
||||
sepcount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ipv6 && sepcount < totalcount / 2)
|
||||
continue;
|
||||
if (ipv6 && sepcount < totalcount / 2)
|
||||
continue;
|
||||
|
||||
if (!ipv6 && sepcount < 2)
|
||||
continue;
|
||||
if (!ipv6 && sepcount < 2)
|
||||
continue;
|
||||
|
||||
*tptr = chartable[(*tptr + accum) % 20];
|
||||
accum = (accum << 1) | (accum >> 31);
|
||||
}
|
||||
*tptr = chartable[(*tptr + accum) % 20];
|
||||
accum = (accum << 1) | (accum >> 31);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
uint32_t accum = fnv_hash((const unsigned char*) inbuf, 32);
|
||||
|
||||
rb_strlcpy(outbuf, inbuf, HOSTLEN + 1);
|
||||
rb_strlcpy(outbuf, inbuf, HOSTLEN + 1);
|
||||
|
||||
/* 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 FNV hash 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);
|
||||
}
|
||||
/* 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;
|
||||
/* 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);
|
||||
}
|
||||
accum = (accum << 1) | (accum >> 31);
|
||||
}
|
||||
}
|
||||
|
||||
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['x']))
|
||||
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['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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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['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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) infinity-infinity God <God@Heaven>
|
||||
*
|
||||
* Bob was here
|
||||
* Bob was here
|
||||
*/
|
||||
|
||||
#include "stdinc.h"
|
||||
|
@ -13,9 +13,10 @@
|
|||
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 };
|
||||
|
@ -27,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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,10 +41,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,22 +56,21 @@ 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");
|
||||
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]);
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ 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}}
|
||||
"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 };
|
||||
|
||||
|
@ -35,64 +35,58 @@ 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;
|
||||
char *p, *name;
|
||||
char *s = LOCAL_COPY(parv[1]);
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
|
||||
name = rb_strtok_r(s, ",", &p);
|
||||
name = rb_strtok_r(s, ",", &p);
|
||||
|
||||
/* Finish the flood grace period... */
|
||||
if(MyClient(source_p) && !IsFloodDone(source_p))
|
||||
flood_endgrace(source_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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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);
|
||||
if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
|
||||
check_spambot_warning(source_p, NULL);
|
||||
|
||||
return 0;
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -35,11 +35,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 };
|
||||
|
@ -53,62 +53,54 @@ DECLARE_MODULE_AV1(findforwards, NULL, NULL, findforwards_clist, NULL, NULL, "$R
|
|||
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_any_op(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();
|
||||
}
|
||||
|
||||
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((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(buf[0])
|
||||
*(--p) = '\0';
|
||||
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++ = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
sendto_one_notice(source_p, ":Forwards for %s: %s", parv[1], buf);
|
||||
if(buf[0])
|
||||
*(--p) = '\0';
|
||||
|
||||
return 0;
|
||||
sendto_one_notice(source_p, ":Forwards for %s: %s", parv[1], buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -48,11 +48,11 @@
|
|||
#include "modules.h"
|
||||
|
||||
static int mo_forcejoin(struct Client *client_p, struct Client *source_p,
|
||||
int parc, const char *parv[]);
|
||||
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}}
|
||||
"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 };
|
||||
|
@ -67,152 +67,137 @@ DECLARE_MODULE_AV1(force, NULL, NULL, force_clist, NULL, NULL, "$Revision: 3297
|
|||
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;
|
||||
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(!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((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 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;
|
||||
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);
|
||||
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';
|
||||
}
|
||||
/* 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(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;
|
||||
}
|
||||
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);
|
||||
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_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);
|
||||
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(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);
|
||||
}
|
||||
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_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;
|
||||
}
|
||||
/* 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;
|
||||
}
|
||||
/* 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);
|
||||
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);
|
||||
/* 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);
|
||||
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;
|
||||
chptr->mode.mode |= MODE_TOPICLIMIT;
|
||||
chptr->mode.mode |= MODE_NOPRIVMSGS;
|
||||
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +nt", me.name, chptr->chname);
|
||||
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);
|
||||
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;
|
||||
/* 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;
|
||||
}
|
||||
|
|
|
@ -52,49 +52,45 @@ 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;
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
#include <string.h>
|
||||
|
||||
static int m_mkpasswd(struct Client *client_p, struct Client *source_p,
|
||||
int parc, const char *parv[]);
|
||||
int parc, const char *parv[]);
|
||||
static int mo_mkpasswd(struct Client *client_p, struct Client *source_p,
|
||||
int parc, const char *parv[]);
|
||||
int parc, const char *parv[]);
|
||||
|
||||
static char *make_md5_salt(int);
|
||||
static char *make_sha256_salt(int);
|
||||
|
@ -26,11 +26,11 @@ static char *generate_random_salt(char *, int);
|
|||
static char *generate_poor_salt(char *, int);
|
||||
|
||||
static char saltChars[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
/* 0 .. 63, ascii - 64 */
|
||||
/* 0 .. 63, ascii - 64 */
|
||||
|
||||
struct Message mkpasswd_msgtab = {
|
||||
"MKPASSWD", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_mkpasswd, 2}, mg_ignore, mg_ignore, mg_ignore, {mo_mkpasswd, 2}}
|
||||
"MKPASSWD", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_mkpasswd, 2}, mg_ignore, mg_ignore, mg_ignore, {mo_mkpasswd, 2}}
|
||||
};
|
||||
|
||||
mapi_clist_av1 mkpasswd_clist[] = { &mkpasswd_msgtab, NULL };
|
||||
|
@ -45,46 +45,42 @@ DECLARE_MODULE_AV1(mkpasswd, NULL, NULL, mkpasswd_clist, NULL, NULL, "$Revision$
|
|||
static int
|
||||
m_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
static time_t last_used = 0;
|
||||
char *salt;
|
||||
const char *hashtype;
|
||||
const char hashdefault[] = "SHA512";
|
||||
static time_t last_used = 0;
|
||||
char *salt;
|
||||
const char *hashtype;
|
||||
const char hashdefault[] = "SHA512";
|
||||
|
||||
if(EmptyString(parv[1]))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
|
||||
return 0;
|
||||
}
|
||||
if(EmptyString(parv[1])) {
|
||||
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(parc < 3)
|
||||
hashtype = hashdefault;
|
||||
else
|
||||
hashtype = parv[2];
|
||||
if(parc < 3)
|
||||
hashtype = hashdefault;
|
||||
else
|
||||
hashtype = parv[2];
|
||||
|
||||
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
|
||||
{
|
||||
/* safe enough to give this on a local connect only */
|
||||
sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "MKPASSWD");
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
last_used = rb_current_time();
|
||||
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) {
|
||||
/* safe enough to give this on a local connect only */
|
||||
sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "MKPASSWD");
|
||||
return 0;
|
||||
} else
|
||||
last_used = rb_current_time();
|
||||
|
||||
if(!irccmp(hashtype, "SHA256"))
|
||||
salt = make_sha256_salt(16);
|
||||
else if(!irccmp(hashtype, "SHA512"))
|
||||
salt = make_sha512_salt(16);
|
||||
else if(!irccmp(hashtype, "MD5"))
|
||||
salt = make_md5_salt(8);
|
||||
else
|
||||
{
|
||||
sendto_one_notice(source_p,
|
||||
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
|
||||
return 0;
|
||||
}
|
||||
if(!irccmp(hashtype, "SHA256"))
|
||||
salt = make_sha256_salt(16);
|
||||
else if(!irccmp(hashtype, "SHA512"))
|
||||
salt = make_sha512_salt(16);
|
||||
else if(!irccmp(hashtype, "MD5"))
|
||||
salt = make_md5_salt(8);
|
||||
else {
|
||||
sendto_one_notice(source_p,
|
||||
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
|
||||
return 0;
|
||||
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* mo_mkpasswd - mkpasswd message handler
|
||||
|
@ -94,124 +90,115 @@ m_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const cha
|
|||
static int
|
||||
mo_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
char *salt;
|
||||
const char *hashtype;
|
||||
const char hashdefault[] = "SHA512";
|
||||
char *salt;
|
||||
const char *hashtype;
|
||||
const char hashdefault[] = "SHA512";
|
||||
|
||||
if(EmptyString(parv[1]))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
|
||||
return 0;
|
||||
}
|
||||
if(EmptyString(parv[1])) {
|
||||
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(parc < 3)
|
||||
hashtype = hashdefault;
|
||||
else
|
||||
hashtype = parv[2];
|
||||
if(parc < 3)
|
||||
hashtype = hashdefault;
|
||||
else
|
||||
hashtype = parv[2];
|
||||
|
||||
if(!irccmp(hashtype, "SHA256"))
|
||||
salt = make_sha256_salt(16);
|
||||
else if(!irccmp(hashtype, "SHA512"))
|
||||
salt = make_sha512_salt(16);
|
||||
else if(!irccmp(hashtype, "MD5"))
|
||||
salt = make_md5_salt(8);
|
||||
else
|
||||
{
|
||||
sendto_one_notice(source_p,
|
||||
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
|
||||
return 0;
|
||||
}
|
||||
if(!irccmp(hashtype, "SHA256"))
|
||||
salt = make_sha256_salt(16);
|
||||
else if(!irccmp(hashtype, "SHA512"))
|
||||
salt = make_sha512_salt(16);
|
||||
else if(!irccmp(hashtype, "MD5"))
|
||||
salt = make_md5_salt(8);
|
||||
else {
|
||||
sendto_one_notice(source_p,
|
||||
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
|
||||
return 0;
|
||||
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
make_md5_salt(int length)
|
||||
{
|
||||
static char salt[21];
|
||||
if(length > 16)
|
||||
{
|
||||
printf("MD5 salt length too long\n");
|
||||
exit(0);
|
||||
}
|
||||
salt[0] = '$';
|
||||
salt[1] = '1';
|
||||
salt[2] = '$';
|
||||
generate_random_salt(&salt[3], length);
|
||||
salt[length + 3] = '$';
|
||||
salt[length + 4] = '\0';
|
||||
return salt;
|
||||
static char salt[21];
|
||||
if(length > 16) {
|
||||
printf("MD5 salt length too long\n");
|
||||
exit(0);
|
||||
}
|
||||
salt[0] = '$';
|
||||
salt[1] = '1';
|
||||
salt[2] = '$';
|
||||
generate_random_salt(&salt[3], length);
|
||||
salt[length + 3] = '$';
|
||||
salt[length + 4] = '\0';
|
||||
return salt;
|
||||
}
|
||||
|
||||
char *
|
||||
make_sha256_salt(int length)
|
||||
{
|
||||
static char salt[21];
|
||||
if(length > 16)
|
||||
{
|
||||
printf("SHA256 salt length too long\n");
|
||||
exit(0);
|
||||
}
|
||||
salt[0] = '$';
|
||||
salt[1] = '5';
|
||||
salt[2] = '$';
|
||||
generate_random_salt(&salt[3], length);
|
||||
salt[length + 3] = '$';
|
||||
salt[length + 4] = '\0';
|
||||
return salt;
|
||||
static char salt[21];
|
||||
if(length > 16) {
|
||||
printf("SHA256 salt length too long\n");
|
||||
exit(0);
|
||||
}
|
||||
salt[0] = '$';
|
||||
salt[1] = '5';
|
||||
salt[2] = '$';
|
||||
generate_random_salt(&salt[3], length);
|
||||
salt[length + 3] = '$';
|
||||
salt[length + 4] = '\0';
|
||||
return salt;
|
||||
}
|
||||
|
||||
char *
|
||||
make_sha512_salt(int length)
|
||||
{
|
||||
static char salt[21];
|
||||
if(length > 16)
|
||||
{
|
||||
printf("SHA512 salt length too long\n");
|
||||
exit(0);
|
||||
}
|
||||
salt[0] = '$';
|
||||
salt[1] = '6';
|
||||
salt[2] = '$';
|
||||
generate_random_salt(&salt[3], length);
|
||||
salt[length + 3] = '$';
|
||||
salt[length + 4] = '\0';
|
||||
return salt;
|
||||
static char salt[21];
|
||||
if(length > 16) {
|
||||
printf("SHA512 salt length too long\n");
|
||||
exit(0);
|
||||
}
|
||||
salt[0] = '$';
|
||||
salt[1] = '6';
|
||||
salt[2] = '$';
|
||||
generate_random_salt(&salt[3], length);
|
||||
salt[length + 3] = '$';
|
||||
salt[length + 4] = '\0';
|
||||
return salt;
|
||||
}
|
||||
|
||||
char *
|
||||
generate_poor_salt(char *salt, int length)
|
||||
{
|
||||
int i;
|
||||
srand(time(NULL));
|
||||
for(i = 0; i < length; i++)
|
||||
{
|
||||
salt[i] = saltChars[rand() % 64];
|
||||
}
|
||||
return (salt);
|
||||
int i;
|
||||
srand(time(NULL));
|
||||
for(i = 0; i < length; i++) {
|
||||
salt[i] = saltChars[rand() % 64];
|
||||
}
|
||||
return (salt);
|
||||
}
|
||||
|
||||
char *
|
||||
generate_random_salt(char *salt, int length)
|
||||
{
|
||||
char *buf;
|
||||
int fd, i;
|
||||
if((fd = open("/dev/random", O_RDONLY)) < 0)
|
||||
{
|
||||
return (generate_poor_salt(salt, length));
|
||||
}
|
||||
buf = calloc(1, length);
|
||||
if(read(fd, buf, length) != length)
|
||||
{
|
||||
free(buf);
|
||||
return (generate_poor_salt(salt, length));
|
||||
}
|
||||
char *buf;
|
||||
int fd, i;
|
||||
if((fd = open("/dev/random", O_RDONLY)) < 0) {
|
||||
return (generate_poor_salt(salt, length));
|
||||
}
|
||||
buf = calloc(1, length);
|
||||
if(read(fd, buf, length) != length) {
|
||||
free(buf);
|
||||
return (generate_poor_salt(salt, length));
|
||||
}
|
||||
|
||||
for(i = 0; i < length; i++)
|
||||
{
|
||||
salt[i] = saltChars[abs(buf[i]) % 64];
|
||||
}
|
||||
free(buf);
|
||||
return (salt);
|
||||
for(i = 0; i < length; i++) {
|
||||
salt[i] = saltChars[abs(buf[i]) % 64];
|
||||
}
|
||||
free(buf);
|
||||
return (salt);
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
static int mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
||||
|
||||
struct Message oaccept_msgtab = {
|
||||
"OACCEPT", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_oaccept, 2}}
|
||||
};
|
||||
"OACCEPT", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_oaccept, 2}}
|
||||
};
|
||||
|
||||
mapi_clist_av1 oaccept_clist[] = { &oaccept_msgtab, NULL };
|
||||
|
||||
|
@ -20,46 +20,42 @@ DECLARE_MODULE_AV1(oaccept, NULL, NULL, oaccept_clist, NULL, NULL, "$Id $");
|
|||
static int
|
||||
mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Metadata *md;
|
||||
struct DictionaryIter iter;
|
||||
struct Client *target_p;
|
||||
char text[10];
|
||||
struct Metadata *md;
|
||||
struct DictionaryIter iter;
|
||||
struct Client *target_p;
|
||||
char text[10];
|
||||
|
||||
if(!(target_p = find_client(parv[1])))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NOSUCHNICK), parv[1]);
|
||||
return 0;
|
||||
}
|
||||
if(!(target_p = find_client(parv[1]))) {
|
||||
sendto_one(source_p, form_str(ERR_NOSUCHNICK), parv[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If we don't check for this, and some idiot tries to OACCEPT a server... */
|
||||
if(!IsPerson(target_p))
|
||||
{
|
||||
sendto_one_notice(source_p, ":That is a server, not a user. What are you doing?");
|
||||
return 0;
|
||||
}
|
||||
/* If we don't check for this, and some idiot tries to OACCEPT a server... */
|
||||
if(!IsPerson(target_p)) {
|
||||
sendto_one_notice(source_p, ":That is a server, not a user. What are you doing?");
|
||||
return 0;
|
||||
}
|
||||
|
||||
rb_snprintf(text, sizeof(text), "O%s", source_p->id);
|
||||
snprintf(text, sizeof(text), "O%s", source_p->id);
|
||||
|
||||
/* Provide a nice error message if you try to OACCEPT someone
|
||||
* who you've already OACCEPTed. */
|
||||
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
|
||||
{
|
||||
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text))
|
||||
{
|
||||
sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* Provide a nice error message if you try to OACCEPT someone
|
||||
* who you've already OACCEPTed. */
|
||||
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata) {
|
||||
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text)) {
|
||||
sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
user_metadata_add(target_p, text, "OACCEPT", 1);
|
||||
user_metadata_add(target_p, text, "OACCEPT", 1);
|
||||
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OACCEPT called for %s by %s!%s@%s",
|
||||
target_p->name,
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OACCEPT called for %s by %s!%s@%s",
|
||||
me.name, target_p->name, source_p->name, source_p->username,
|
||||
source_p->host);
|
||||
return 0;
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OACCEPT called for %s by %s!%s@%s",
|
||||
target_p->name,
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OACCEPT called for %s by %s!%s@%s",
|
||||
me.name, target_p->name, source_p->name, source_p->username,
|
||||
source_p->host);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,17 +20,17 @@
|
|||
|
||||
#include "stdinc.h"
|
||||
#include "channel.h"
|
||||
#include "client.h"
|
||||
#include "client.h"
|
||||
#include "ircd.h"
|
||||
#include "numeric.h"
|
||||
#include "logger.h"
|
||||
#include "s_serv.h"
|
||||
#include "s_conf.h"
|
||||
#include "s_newconf.h"
|
||||
#include "s_newconf.h"
|
||||
#include "send.h"
|
||||
#include "whowas.h"
|
||||
#include "match.h"
|
||||
#include "hash.h"
|
||||
#include "hash.h"
|
||||
#include "msg.h"
|
||||
#include "parse.h"
|
||||
#include "modules.h"
|
||||
|
@ -39,8 +39,8 @@ static int mo_ojoin(struct Client *client_p, struct Client *source_p, int parc,
|
|||
|
||||
|
||||
struct Message ojoin_msgtab = {
|
||||
"OJOIN", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_ojoin, 2}}
|
||||
"OJOIN", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_ojoin, 2}}
|
||||
};
|
||||
|
||||
mapi_clist_av1 ojoin_clist[] = { &ojoin_msgtab, NULL };
|
||||
|
@ -54,133 +54,117 @@ DECLARE_MODULE_AV1(ojoin, NULL, NULL, ojoin_clist, NULL, NULL, "$Revision: 3554
|
|||
static int
|
||||
mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr;
|
||||
int move_me = 0;
|
||||
struct Channel *chptr;
|
||||
int move_me = 0;
|
||||
|
||||
/* admins only */
|
||||
if(!IsOperAdmin(source_p))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
|
||||
return 0;
|
||||
}
|
||||
/* admins only */
|
||||
if(!IsOperAdmin(source_p)) {
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(*parv[1] == '@' || *parv[1] == '%' || *parv[1] == '+' || *parv[1] == '!' || *parv[1] == '~')
|
||||
{
|
||||
parv[1]++;
|
||||
move_me = 1;
|
||||
}
|
||||
if(*parv[1] == '@' || *parv[1] == '%' || *parv[1] == '+' || *parv[1] == '!' || *parv[1] == '~') {
|
||||
parv[1]++;
|
||||
move_me = 1;
|
||||
}
|
||||
|
||||
if((chptr = find_channel(parv[1])) == NULL)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
||||
form_str(ERR_NOSUCHCHANNEL), parv[1]);
|
||||
return 0;
|
||||
}
|
||||
if((chptr = find_channel(parv[1])) == NULL) {
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
||||
form_str(ERR_NOSUCHCHANNEL), parv[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(IsMember(source_p, chptr))
|
||||
{
|
||||
sendto_one_notice(source_p, ":Please part %s before using OJOIN", parv[1]);
|
||||
return 0;
|
||||
}
|
||||
if(IsMember(source_p, chptr)) {
|
||||
sendto_one_notice(source_p, ":Please part %s before using OJOIN", parv[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(move_me == 1)
|
||||
parv[1]--;
|
||||
if(move_me == 1)
|
||||
parv[1]--;
|
||||
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OJOIN called for %s by %s!%s@%s",
|
||||
parv[1], source_p->name, source_p->username, source_p->host);
|
||||
ilog(L_MAIN, "OJOIN called for %s by %s",
|
||||
parv[1], get_oper_name(source_p));
|
||||
/* only sends stuff for #channels remotely */
|
||||
sendto_server(NULL, chptr, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OJOIN called for %s by %s!%s@%s",
|
||||
me.name, parv[1],
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OJOIN called for %s by %s!%s@%s",
|
||||
parv[1], source_p->name, source_p->username, source_p->host);
|
||||
ilog(L_MAIN, "OJOIN called for %s by %s",
|
||||
parv[1], get_oper_name(source_p));
|
||||
/* only sends stuff for #channels remotely */
|
||||
sendto_server(NULL, chptr, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OJOIN called for %s by %s!%s@%s",
|
||||
me.name, parv[1],
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
|
||||
if(*parv[1] == '~' && ConfigChannel.use_owner)
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_OWNER);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :~%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
}
|
||||
else if(*parv[1] == '!' && ConfigChannel.use_admin)
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_ADMIN);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :!%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
if(*parv[1] == '~' && ConfigChannel.use_owner) {
|
||||
add_user_to_channel(chptr, source_p, CHFL_OWNER);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :~%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
} else if(*parv[1] == '!' && ConfigChannel.use_admin) {
|
||||
add_user_to_channel(chptr, source_p, CHFL_ADMIN);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :!%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
|
||||
}
|
||||
else if(*parv[1] == '@')
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :@%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
} else if(*parv[1] == '@') {
|
||||
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :@%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
|
||||
}
|
||||
else if(*parv[1] == '%' && ConfigChannel.use_halfop)
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_HALFOP);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :%s%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, "%", source_p->id);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
}
|
||||
else if(*parv[1] == '+')
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_VOICE);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :+%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +v %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_PEON);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s JOIN %ld %s +",
|
||||
source_p->id, (long) chptr->channelts, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
}
|
||||
} else if(*parv[1] == '%' && ConfigChannel.use_halfop) {
|
||||
add_user_to_channel(chptr, source_p, CHFL_HALFOP);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :%s%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, "%", source_p->id);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
} else if(*parv[1] == '+') {
|
||||
add_user_to_channel(chptr, source_p, CHFL_VOICE);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :+%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +v %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
} else {
|
||||
add_user_to_channel(chptr, source_p, CHFL_PEON);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s JOIN %ld %s +",
|
||||
source_p->id, (long) chptr->channelts, chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
}
|
||||
|
||||
/* send the topic... */
|
||||
if(chptr->topic != NULL)
|
||||
{
|
||||
sendto_one(source_p, form_str(RPL_TOPIC), me.name,
|
||||
source_p->name, chptr->chname, chptr->topic);
|
||||
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), me.name,
|
||||
source_p->name, chptr->chname, chptr->topic_info, chptr->topic_time);
|
||||
}
|
||||
/* send the topic... */
|
||||
if(chptr->topic != NULL) {
|
||||
sendto_one(source_p, form_str(RPL_TOPIC), me.name,
|
||||
source_p->name, chptr->chname, chptr->topic);
|
||||
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), me.name,
|
||||
source_p->name, chptr->chname, chptr->topic_info, chptr->topic_time);
|
||||
}
|
||||
|
||||
source_p->localClient->last_join_time = rb_current_time();
|
||||
channel_member_names(chptr, source_p, 1);
|
||||
source_p->localClient->last_join_time = rb_current_time();
|
||||
channel_member_names(chptr, source_p, 1);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ static int mo_okick(struct Client *client_p, struct Client *source_p, int parc,
|
|||
|
||||
|
||||
struct Message okick_msgtab = {
|
||||
"OKICK", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_okick, 4}}
|
||||
"OKICK", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_okick, 4}}
|
||||
};
|
||||
|
||||
mapi_clist_av1 okick_clist[] = { &okick_msgtab, NULL };
|
||||
|
@ -58,89 +58,84 @@ DECLARE_MODULE_AV1(okick, NULL, NULL, okick_clist, NULL, NULL, "$Revision: 3554
|
|||
static int
|
||||
mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Client *who;
|
||||
struct Client *target_p;
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
int chasing = 0;
|
||||
char *comment;
|
||||
char *name;
|
||||
char *p = NULL;
|
||||
char *user;
|
||||
char text[10];
|
||||
static char buf[BUFSIZE];
|
||||
struct Client *who;
|
||||
struct Client *target_p;
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
int chasing = 0;
|
||||
char *comment;
|
||||
char *name;
|
||||
char *p = NULL;
|
||||
char *user;
|
||||
char text[10];
|
||||
static char buf[BUFSIZE];
|
||||
|
||||
if(*parv[2] == '\0')
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "KICK");
|
||||
return 0;
|
||||
}
|
||||
if(*parv[2] == '\0') {
|
||||
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "KICK");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(MyClient(source_p) && !IsFloodDone(source_p))
|
||||
flood_endgrace(source_p);
|
||||
if(MyClient(source_p) && !IsFloodDone(source_p))
|
||||
flood_endgrace(source_p);
|
||||
|
||||
comment = (EmptyString(LOCAL_COPY(parv[3]))) ? LOCAL_COPY(parv[2]) : LOCAL_COPY(parv[3]);
|
||||
if(strlen(comment) > (size_t) TOPICLEN)
|
||||
comment[TOPICLEN] = '\0';
|
||||
comment = (EmptyString(LOCAL_COPY(parv[3]))) ? LOCAL_COPY(parv[2]) : LOCAL_COPY(parv[3]);
|
||||
if(strlen(comment) > (size_t) TOPICLEN)
|
||||
comment[TOPICLEN] = '\0';
|
||||
|
||||
*buf = '\0';
|
||||
if((p = strchr(parv[1], ',')))
|
||||
*p = '\0';
|
||||
*buf = '\0';
|
||||
if((p = strchr(parv[1], ',')))
|
||||
*p = '\0';
|
||||
|
||||
name = LOCAL_COPY(parv[1]);
|
||||
name = LOCAL_COPY(parv[1]);
|
||||
|
||||
chptr = find_channel(name);
|
||||
if(!chptr)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
|
||||
return 0;
|
||||
}
|
||||
chptr = find_channel(name);
|
||||
if(!chptr) {
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if((p = strchr(parv[2], ',')))
|
||||
*p = '\0';
|
||||
user = LOCAL_COPY(parv[2]); // strtoken(&p2, parv[2], ",");
|
||||
if(!(who = find_chasing(source_p, user, &chasing)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if((p = strchr(parv[2], ',')))
|
||||
*p = '\0';
|
||||
user = LOCAL_COPY(parv[2]); // strtoken(&p2, parv[2], ",");
|
||||
if(!(who = find_chasing(source_p, user, &chasing))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((target_p = find_client(user)) == NULL)
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, user);
|
||||
return 0;
|
||||
}
|
||||
if((target_p = find_client(user)) == NULL) {
|
||||
sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, user);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((msptr = find_channel_membership(chptr, target_p)) == NULL)
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL),
|
||||
me.name, source_p->name, parv[1], parv[2]);
|
||||
return 0;
|
||||
}
|
||||
if((msptr = find_channel_membership(chptr, target_p)) == NULL) {
|
||||
sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL),
|
||||
me.name, source_p->name, parv[1], parv[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OKICK called for %s %s by %s!%s@%s",
|
||||
chptr->chname, target_p->name,
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
ilog(L_MAIN, "OKICK called for %s %s by %s",
|
||||
chptr->chname, target_p->name,
|
||||
get_oper_name(source_p));
|
||||
/* only sends stuff for #channels remotely */
|
||||
sendto_server(NULL, chptr, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OKICK called for %s %s by %s!%s@%s",
|
||||
me.name, chptr->chname, target_p->name,
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OKICK called for %s %s by %s!%s@%s",
|
||||
chptr->chname, target_p->name,
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
ilog(L_MAIN, "OKICK called for %s %s by %s",
|
||||
chptr->chname, target_p->name,
|
||||
get_oper_name(source_p));
|
||||
/* only sends stuff for #channels remotely */
|
||||
sendto_server(NULL, chptr, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OKICK called for %s %s by %s!%s@%s",
|
||||
me.name, chptr->chname, target_p->name,
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s KICK %s %s :%s",
|
||||
me.name, chptr->chname, who->name, comment);
|
||||
sendto_server(&me, chptr, CAP_TS6, NOCAPS,
|
||||
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
|
||||
remove_user_from_channel(msptr);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s KICK %s %s :%s",
|
||||
me.name, chptr->chname, who->name, comment);
|
||||
sendto_server(&me, chptr, CAP_TS6, NOCAPS,
|
||||
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
|
||||
remove_user_from_channel(msptr);
|
||||
|
||||
rb_snprintf(text, sizeof(text), "K%s", who->id);
|
||||
snprintf(text, sizeof(text), "K%s", who->id);
|
||||
|
||||
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
|
||||
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)
|
||||
channel_metadata_time_add(chptr, text, rb_current_time(), "KICKNOREJOIN");
|
||||
return 0;
|
||||
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
|
||||
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)
|
||||
channel_metadata_time_add(chptr, text, rb_current_time(), "KICKNOREJOIN");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ static int mo_olist(struct Client *, struct Client *, int parc, const char *parv
|
|||
#ifndef STATIC_MODULES
|
||||
|
||||
struct Message olist_msgtab = {
|
||||
"OLIST", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_olist, 1}}
|
||||
"OLIST", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_olist, 1}}
|
||||
};
|
||||
|
||||
mapi_clist_av1 olist_clist[] = { &olist_msgtab, NULL };
|
||||
|
@ -66,23 +66,22 @@ static void list_named_channel(struct Client *source_p, const char *name);
|
|||
static int
|
||||
mo_olist(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
if(!IsOperSpy(source_p))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
||||
me.name, source_p->name, "oper_spy");
|
||||
sendto_one(source_p, form_str(RPL_LISTEND),
|
||||
me.name, source_p->name);
|
||||
return 0;
|
||||
}
|
||||
if(!IsOperSpy(source_p)) {
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
||||
me.name, source_p->name, "oper_spy");
|
||||
sendto_one(source_p, form_str(RPL_LISTEND),
|
||||
me.name, source_p->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If no arg, do all channels *whee*, else just one channel */
|
||||
if(parc < 2 || EmptyString(parv[1]))
|
||||
list_all_channels(source_p);
|
||||
else
|
||||
list_named_channel(source_p, parv[1]);
|
||||
/* If no arg, do all channels *whee*, else just one channel */
|
||||
if(parc < 2 || EmptyString(parv[1]))
|
||||
list_all_channels(source_p);
|
||||
else
|
||||
list_named_channel(source_p, parv[1]);
|
||||
|
||||
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
|
||||
return 0;
|
||||
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,24 +94,23 @@ mo_olist(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
static void
|
||||
list_all_channels(struct Client *source_p)
|
||||
{
|
||||
struct Channel *chptr;
|
||||
rb_dlink_node *ptr;
|
||||
struct Channel *chptr;
|
||||
rb_dlink_node *ptr;
|
||||
|
||||
report_operspy(source_p, "LIST", NULL);
|
||||
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
|
||||
report_operspy(source_p, "LIST", NULL);
|
||||
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
|
||||
|
||||
RB_DLINK_FOREACH(ptr, global_channel_list.head)
|
||||
{
|
||||
chptr = ptr->data;
|
||||
RB_DLINK_FOREACH(ptr, global_channel_list.head) {
|
||||
chptr = ptr->data;
|
||||
|
||||
sendto_one(source_p, ":%s 322 %s %s %lu :[%s] %s",
|
||||
me.name, source_p->name, chptr->chname,
|
||||
rb_dlink_list_length(&chptr->members),
|
||||
channel_modes(chptr, &me),
|
||||
chptr->topic == NULL ? "" : chptr->topic);
|
||||
}
|
||||
sendto_one(source_p, ":%s 322 %s %s %lu :[%s] %s",
|
||||
me.name, source_p->name, chptr->chname,
|
||||
rb_dlink_list_length(&chptr->members),
|
||||
channel_modes(chptr, &me),
|
||||
chptr->topic == NULL ? "" : chptr->topic);
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -124,28 +122,28 @@ list_all_channels(struct Client *source_p)
|
|||
static void
|
||||
list_named_channel(struct Client *source_p, const char *name)
|
||||
{
|
||||
struct Channel *chptr;
|
||||
char *p;
|
||||
char *n = LOCAL_COPY(name);
|
||||
struct Channel *chptr;
|
||||
char *p;
|
||||
char *n = LOCAL_COPY(name);
|
||||
|
||||
if((p = strchr(n, ',')))
|
||||
*p = '\0';
|
||||
if((p = strchr(n, ',')))
|
||||
*p = '\0';
|
||||
|
||||
/* Put operspy notice before any output, but only if channel exists */
|
||||
chptr = EmptyString(n) ? NULL : find_channel(n);
|
||||
if(chptr != NULL)
|
||||
report_operspy(source_p, "LIST", chptr->chname);
|
||||
/* Put operspy notice before any output, but only if channel exists */
|
||||
chptr = EmptyString(n) ? NULL : find_channel(n);
|
||||
if(chptr != NULL)
|
||||
report_operspy(source_p, "LIST", chptr->chname);
|
||||
|
||||
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
|
||||
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
|
||||
|
||||
if(EmptyString(n))
|
||||
return;
|
||||
if(EmptyString(n))
|
||||
return;
|
||||
|
||||
if(chptr == NULL)
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
||||
form_str(ERR_NOSUCHCHANNEL), n);
|
||||
else
|
||||
sendto_one(source_p, ":%s 322 %s %s %lu :[%s] %s", me.name, source_p->name,
|
||||
chptr->chname, rb_dlink_list_length(&chptr->members),
|
||||
channel_modes(chptr, &me), chptr->topic ? chptr->topic : "");
|
||||
if(chptr == NULL)
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
||||
form_str(ERR_NOSUCHCHANNEL), n);
|
||||
else
|
||||
sendto_one(source_p, ":%s 322 %s %s %lu :[%s] %s", me.name, source_p->name,
|
||||
chptr->chname, rb_dlink_list_length(&chptr->members),
|
||||
channel_modes(chptr, &me), chptr->topic ? chptr->topic : "");
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
static int mo_omode(struct Client *, struct Client *, int, const char **);
|
||||
|
||||
struct Message omode_msgtab = {
|
||||
"OMODE", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_omode, 3}}
|
||||
"OMODE", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_omode, 3}}
|
||||
};
|
||||
|
||||
mapi_clist_av1 omode_clist[] = { &omode_msgtab, NULL };
|
||||
|
@ -59,199 +59,174 @@ DECLARE_MODULE_AV1(omode, NULL, NULL, omode_clist, NULL, NULL, "$Revision: 3121
|
|||
static int
|
||||
mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr = NULL;
|
||||
struct membership *msptr;
|
||||
char params[512];
|
||||
int i;
|
||||
int wasonchannel;
|
||||
struct Channel *chptr = NULL;
|
||||
struct membership *msptr;
|
||||
char params[512];
|
||||
int i;
|
||||
int wasonchannel;
|
||||
|
||||
/* admins only */
|
||||
if(!IsOperAdmin(source_p))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
|
||||
return 0;
|
||||
}
|
||||
/* admins only */
|
||||
if(!IsOperAdmin(source_p)) {
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Now, try to find the channel in question */
|
||||
if(!IsChanPrefix(parv[1][0]) || !check_channel_name(parv[1]))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME,
|
||||
form_str(ERR_BADCHANNAME), parv[1]);
|
||||
return 0;
|
||||
}
|
||||
/* Now, try to find the channel in question */
|
||||
if(!IsChanPrefix(parv[1][0]) || !check_channel_name(parv[1])) {
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME,
|
||||
form_str(ERR_BADCHANNAME), parv[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
chptr = find_channel(parv[1]);
|
||||
chptr = find_channel(parv[1]);
|
||||
|
||||
if(chptr == NULL)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
||||
form_str(ERR_NOSUCHCHANNEL), parv[1]);
|
||||
return 0;
|
||||
}
|
||||
if(chptr == NULL) {
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
||||
form_str(ERR_NOSUCHCHANNEL), parv[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Now know the channel exists */
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
wasonchannel = msptr != NULL;
|
||||
/* Now know the channel exists */
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
wasonchannel = msptr != NULL;
|
||||
|
||||
if (is_any_op(msptr))
|
||||
{
|
||||
sendto_one_notice(source_p, ":Use a normal MODE you idiot");
|
||||
return 0;
|
||||
}
|
||||
if (is_any_op(msptr)) {
|
||||
sendto_one_notice(source_p, ":Use a normal MODE you idiot");
|
||||
return 0;
|
||||
}
|
||||
|
||||
params[0] = '\0';
|
||||
for (i = 2; i < parc; i++)
|
||||
{
|
||||
if (i != 2)
|
||||
rb_strlcat(params, " ", sizeof params);
|
||||
rb_strlcat(params, parv[i], sizeof params);
|
||||
}
|
||||
params[0] = '\0';
|
||||
for (i = 2; i < parc; i++) {
|
||||
if (i != 2)
|
||||
rb_strlcat(params, " ", sizeof params);
|
||||
rb_strlcat(params, parv[i], sizeof params);
|
||||
}
|
||||
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OMODE called for [%s] [%s] by %s!%s@%s",
|
||||
parv[1], params, source_p->name, source_p->username, source_p->host);
|
||||
ilog(L_MAIN, "OMODE called for [%s] [%s] by %s",
|
||||
parv[1], params, get_oper_name(source_p));
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OMODE called for [%s] [%s] by %s!%s@%s",
|
||||
parv[1], params, source_p->name, source_p->username, source_p->host);
|
||||
ilog(L_MAIN, "OMODE called for [%s] [%s] by %s",
|
||||
parv[1], params, get_oper_name(source_p));
|
||||
|
||||
if(*chptr->chname != '&')
|
||||
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OMODE called for [%s] [%s] by %s!%s@%s",
|
||||
me.name, parv[1], params, source_p->name, source_p->username,
|
||||
source_p->host);
|
||||
if(*chptr->chname != '&')
|
||||
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OMODE called for [%s] [%s] by %s!%s@%s",
|
||||
me.name, parv[1], params, source_p->name, source_p->username,
|
||||
source_p->host);
|
||||
|
||||
#if 0
|
||||
set_channel_mode(client_p, source_p->servptr, chptr, msptr,
|
||||
parc - 2, parv + 2);
|
||||
set_channel_mode(client_p, source_p->servptr, chptr, msptr,
|
||||
parc - 2, parv + 2);
|
||||
#else
|
||||
if (parc == 4 && !strcmp(parv[2], "+y") && !irccmp(parv[3], source_p->name))
|
||||
{
|
||||
/* Ownering themselves */
|
||||
if (!wasonchannel)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s",
|
||||
me.name, parv[1], source_p->name);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s TMODE %ld %s +y %s",
|
||||
me.id, (long) chptr->channelts, parv[1],
|
||||
source_p->id);
|
||||
msptr->flags |= CHFL_OWNER;
|
||||
if (parc == 4 && !strcmp(parv[2], "+y") && !irccmp(parv[3], source_p->name)) {
|
||||
/* Ownering themselves */
|
||||
if (!wasonchannel) {
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
else if (parc == 4 && !strcmp(parv[2], "+a") && !irccmp(parv[3], source_p->name))
|
||||
{
|
||||
/* Admining themselves */
|
||||
if (!wasonchannel)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s",
|
||||
me.name, parv[1], source_p->name);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s TMODE %ld %s +a %s",
|
||||
me.id, (long) chptr->channelts, parv[1],
|
||||
source_p->id);
|
||||
msptr->flags |= CHFL_ADMIN;
|
||||
}
|
||||
else if (parc == 4 && !strcmp(parv[2], "+o") && !irccmp(parv[3], source_p->name))
|
||||
{
|
||||
/* Opping themselves */
|
||||
if (!wasonchannel)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
|
||||
me.name, parv[1], source_p->name);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s TMODE %ld %s +o %s",
|
||||
me.id, (long) chptr->channelts, parv[1],
|
||||
source_p->id);
|
||||
msptr->flags |= CHFL_CHANOP;
|
||||
}
|
||||
else if (parc == 4 && !strcmp(parv[2], "+h") && !irccmp(parv[3], source_p->name))
|
||||
{
|
||||
/* Halfopping themselves */
|
||||
if (!wasonchannel)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s",
|
||||
me.name, parv[1], source_p->name);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s TMODE %ld %s +h %s",
|
||||
me.id, (long) chptr->channelts, parv[1],
|
||||
source_p->id);
|
||||
msptr->flags |= CHFL_HALFOP;
|
||||
}
|
||||
else if (ConfigChannel.use_owner)
|
||||
{
|
||||
/* I hope this is correct.
|
||||
* -- Kabaka */
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s",
|
||||
me.name, parv[1], source_p->name);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s TMODE %ld %s +y %s",
|
||||
me.id, (long) chptr->channelts, parv[1],
|
||||
source_p->id);
|
||||
msptr->flags |= CHFL_OWNER;
|
||||
} else if (parc == 4 && !strcmp(parv[2], "+a") && !irccmp(parv[3], source_p->name)) {
|
||||
/* Admining themselves */
|
||||
if (!wasonchannel) {
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s",
|
||||
me.name, parv[1], source_p->name);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s TMODE %ld %s +a %s",
|
||||
me.id, (long) chptr->channelts, parv[1],
|
||||
source_p->id);
|
||||
msptr->flags |= CHFL_ADMIN;
|
||||
} else if (parc == 4 && !strcmp(parv[2], "+o") && !irccmp(parv[3], source_p->name)) {
|
||||
/* Opping themselves */
|
||||
if (!wasonchannel) {
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
|
||||
me.name, parv[1], source_p->name);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s TMODE %ld %s +o %s",
|
||||
me.id, (long) chptr->channelts, parv[1],
|
||||
source_p->id);
|
||||
msptr->flags |= CHFL_CHANOP;
|
||||
} else if (parc == 4 && !strcmp(parv[2], "+h") && !irccmp(parv[3], source_p->name)) {
|
||||
/* Halfopping themselves */
|
||||
if (!wasonchannel) {
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s",
|
||||
me.name, parv[1], source_p->name);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s TMODE %ld %s +h %s",
|
||||
me.id, (long) chptr->channelts, parv[1],
|
||||
source_p->id);
|
||||
msptr->flags |= CHFL_HALFOP;
|
||||
} else if (ConfigChannel.use_owner) {
|
||||
/* I hope this is correct.
|
||||
* -- Kabaka */
|
||||
|
||||
/* Hack it so set_channel_mode() will accept */
|
||||
if (wasonchannel)
|
||||
msptr->flags |= CHFL_OWNER;
|
||||
else
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
}
|
||||
set_channel_mode(client_p, source_p, chptr, msptr,
|
||||
parc - 2, parv + 2);
|
||||
if (wasonchannel)
|
||||
msptr->flags &= ~CHFL_OWNER;
|
||||
else
|
||||
remove_user_from_channel(msptr);
|
||||
/* Hack it so set_channel_mode() will accept */
|
||||
if (wasonchannel)
|
||||
msptr->flags |= CHFL_OWNER;
|
||||
else {
|
||||
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
}
|
||||
else if (ConfigChannel.use_admin)
|
||||
{
|
||||
/* Hack it so set_channel_mode() will accept */
|
||||
if (wasonchannel)
|
||||
msptr->flags |= CHFL_ADMIN;
|
||||
else
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
}
|
||||
set_channel_mode(client_p, source_p, chptr, msptr,
|
||||
parc - 2, parv + 2);
|
||||
/* We know they were not opped before and they can't have opped
|
||||
* themselves as set_channel_mode() does not allow that
|
||||
* -- jilles */
|
||||
if (wasonchannel)
|
||||
msptr->flags &= ~CHFL_ADMIN;
|
||||
else
|
||||
remove_user_from_channel(msptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* CHFL_ADMIN is only useful if admin is enabled
|
||||
* so hack it with op if it is not. */
|
||||
if (wasonchannel)
|
||||
msptr->flags |= CHFL_CHANOP;
|
||||
else
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
}
|
||||
set_channel_mode(client_p, source_p, chptr, msptr,
|
||||
parc - 2, parv + 2);
|
||||
/* We know they were not opped before and they can't have opped
|
||||
* themselves as set_channel_mode() does not allow that
|
||||
* -- jilles */
|
||||
if (wasonchannel)
|
||||
msptr->flags &= ~CHFL_CHANOP;
|
||||
else
|
||||
remove_user_from_channel(msptr);
|
||||
}
|
||||
set_channel_mode(client_p, source_p, chptr, msptr,
|
||||
parc - 2, parv + 2);
|
||||
if (wasonchannel)
|
||||
msptr->flags &= ~CHFL_OWNER;
|
||||
else
|
||||
remove_user_from_channel(msptr);
|
||||
} else if (ConfigChannel.use_admin) {
|
||||
/* Hack it so set_channel_mode() will accept */
|
||||
if (wasonchannel)
|
||||
msptr->flags |= CHFL_ADMIN;
|
||||
else {
|
||||
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
}
|
||||
set_channel_mode(client_p, source_p, chptr, msptr,
|
||||
parc - 2, parv + 2);
|
||||
/* We know they were not opped before and they can't have opped
|
||||
* themselves as set_channel_mode() does not allow that
|
||||
* -- jilles */
|
||||
if (wasonchannel)
|
||||
msptr->flags &= ~CHFL_ADMIN;
|
||||
else
|
||||
remove_user_from_channel(msptr);
|
||||
} else {
|
||||
/* CHFL_ADMIN is only useful if admin is enabled
|
||||
* so hack it with op if it is not. */
|
||||
if (wasonchannel)
|
||||
msptr->flags |= CHFL_CHANOP;
|
||||
else {
|
||||
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
}
|
||||
set_channel_mode(client_p, source_p, chptr, msptr,
|
||||
parc - 2, parv + 2);
|
||||
/* We know they were not opped before and they can't have opped
|
||||
* themselves as set_channel_mode() does not allow that
|
||||
* -- jilles */
|
||||
if (wasonchannel)
|
||||
msptr->flags &= ~CHFL_CHANOP;
|
||||
else
|
||||
remove_user_from_channel(msptr);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
static int mo_opme(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
||||
|
||||
struct Message opme_msgtab = {
|
||||
"OPME", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_opme, 2}}
|
||||
"OPME", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_opme, 2}}
|
||||
};
|
||||
|
||||
mapi_clist_av1 opme_clist[] = { &opme_msgtab, NULL };
|
||||
|
@ -53,62 +53,57 @@ DECLARE_MODULE_AV1(opme, NULL, NULL, opme_clist, NULL, NULL, "$Revision: 3554 $"
|
|||
static int
|
||||
mo_opme(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
rb_dlink_node *ptr;
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
rb_dlink_node *ptr;
|
||||
|
||||
/* admins only */
|
||||
if(!IsOperAdmin(source_p))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
|
||||
return 0;
|
||||
}
|
||||
/* admins only */
|
||||
if(!IsOperAdmin(source_p)) {
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((chptr = find_channel(parv[1])) == NULL)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
||||
form_str(ERR_NOSUCHCHANNEL), parv[1]);
|
||||
return 0;
|
||||
}
|
||||
if((chptr = find_channel(parv[1])) == NULL) {
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
||||
form_str(ERR_NOSUCHCHANNEL), parv[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
RB_DLINK_FOREACH(ptr, chptr->members.head)
|
||||
{
|
||||
msptr = ptr->data;
|
||||
RB_DLINK_FOREACH(ptr, chptr->members.head) {
|
||||
msptr = ptr->data;
|
||||
|
||||
if(is_chanop(msptr) || is_admin(msptr) || is_owner(msptr))
|
||||
{
|
||||
sendto_one_notice(source_p, ":%s Channel is not opless", parv[1]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(is_chanop(msptr) || is_admin(msptr) || is_owner(msptr)) {
|
||||
sendto_one_notice(source_p, ":%s Channel is not opless", parv[1]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
|
||||
if(msptr == NULL)
|
||||
return 0;
|
||||
if(msptr == NULL)
|
||||
return 0;
|
||||
|
||||
msptr->flags |= CHFL_CHANOP;
|
||||
msptr->flags |= CHFL_CHANOP;
|
||||
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OPME called for [%s] by %s!%s@%s",
|
||||
parv[1], source_p->name, source_p->username, source_p->host);
|
||||
ilog(L_MAIN, "OPME called for [%s] by %s",
|
||||
parv[1], get_oper_name(source_p));
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OPME called for [%s] by %s!%s@%s",
|
||||
parv[1], source_p->name, source_p->username, source_p->host);
|
||||
ilog(L_MAIN, "OPME called for [%s] by %s",
|
||||
parv[1], get_oper_name(source_p));
|
||||
|
||||
/* dont send stuff for local channels remotely. */
|
||||
if(*chptr->chname != '&')
|
||||
{
|
||||
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OPME called for [%s] by %s!%s@%s",
|
||||
me.name, parv[1], source_p->name, source_p->username, source_p->host);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS, ":%s PART %s", source_p->id, parv[1]);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :@%s",
|
||||
me.id, (long) chptr->channelts, parv[1], source_p->id);
|
||||
}
|
||||
/* dont send stuff for local channels remotely. */
|
||||
if(*chptr->chname != '&') {
|
||||
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OPME called for [%s] by %s!%s@%s",
|
||||
me.name, parv[1], source_p->name, source_p->username, source_p->host);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS, ":%s PART %s", source_p->id, parv[1]);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :@%s",
|
||||
me.id, (long) chptr->channelts, parv[1], source_p->id);
|
||||
}
|
||||
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
":%s MODE %s +o %s", me.name, parv[1], source_p->name);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
":%s MODE %s +o %s", me.name, parv[1], source_p->name);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* to clearly show that it is fake. SCENE is a special case and not underlined.
|
||||
* these commands only work on channels set +N
|
||||
*
|
||||
* also adds oper commands FSAY and FACTION, which are like NPC and NPCA
|
||||
* also adds oper commands FSAY and FACTION, which are like NPC and NPCA
|
||||
* except without the underline.
|
||||
*
|
||||
*
|
||||
* all of these messages have the hostmask npc.fakeuser.invalid, and their ident
|
||||
* is the nickname of the user running the commands.
|
||||
*/
|
||||
|
@ -39,57 +39,57 @@ static unsigned int mymode;
|
|||
static int
|
||||
_modinit(void)
|
||||
{
|
||||
/* initalize the +N cmode */
|
||||
mymode = cflag_add('N', chm_simple);
|
||||
if (mymode == 0)
|
||||
return -1;
|
||||
/* initalize the +N cmode */
|
||||
mymode = cflag_add('N', chm_simple);
|
||||
if (mymode == 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_moddeinit(void)
|
||||
{
|
||||
/* orphan the +N cmode on modunload */
|
||||
cflag_orphan('N');
|
||||
/* orphan the +N cmode on modunload */
|
||||
cflag_orphan('N');
|
||||
}
|
||||
|
||||
|
||||
struct Message scene_msgtab = {
|
||||
"SCENE", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_scene, 3}, mg_ignore, mg_ignore, mg_ignore, {m_scene, 3}}
|
||||
"SCENE", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_scene, 3}, mg_ignore, mg_ignore, mg_ignore, {m_scene, 3}}
|
||||
};
|
||||
|
||||
/* this serves as an alias for people who are used to inspircd/unreal m_roleplay */
|
||||
struct Message ambiance_msgtab = {
|
||||
"AMBIANCE", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_scene, 3}, mg_ignore, mg_ignore, mg_ignore, {m_scene, 3}}
|
||||
};
|
||||
"AMBIANCE", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_scene, 3}, mg_ignore, mg_ignore, mg_ignore, {m_scene, 3}}
|
||||
};
|
||||
|
||||
struct Message fsay_msgtab = {
|
||||
"FSAY", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_npc, 4}, mg_ignore, mg_ignore, mg_ignore, {m_fsay, 4}}
|
||||
};
|
||||
"FSAY", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_npc, 4}, mg_ignore, mg_ignore, mg_ignore, {m_fsay, 4}}
|
||||
};
|
||||
|
||||
struct Message faction_msgtab = {
|
||||
"FACTION", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_npca, 4}, mg_ignore, mg_ignore, mg_ignore, {m_faction, 4}}
|
||||
};
|
||||
"FACTION", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_npca, 4}, mg_ignore, mg_ignore, mg_ignore, {m_faction, 4}}
|
||||
};
|
||||
|
||||
struct Message npc_msgtab = {
|
||||
"NPC", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_npc, 4}, mg_ignore, mg_ignore, mg_ignore, {m_npc, 4}}
|
||||
};
|
||||
"NPC", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_npc, 4}, mg_ignore, mg_ignore, mg_ignore, {m_npc, 4}}
|
||||
};
|
||||
|
||||
struct Message npca_msgtab = {
|
||||
"NPCA", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_npca, 4}, mg_ignore, mg_ignore, mg_ignore, {m_npca, 4}}
|
||||
};
|
||||
"NPCA", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, {m_npca, 4}, mg_ignore, mg_ignore, mg_ignore, {m_npca, 4}}
|
||||
};
|
||||
|
||||
struct Message roleplay_msgtab = {
|
||||
"ROLEPLAY", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_ignore, mg_ignore, mg_ignore, mg_ignore, {me_roleplay, 4}, mg_ignore}
|
||||
};
|
||||
"ROLEPLAY", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_ignore, mg_ignore, mg_ignore, mg_ignore, {me_roleplay, 4}, mg_ignore}
|
||||
};
|
||||
|
||||
mapi_clist_av1 roleplay_clist[] = { &scene_msgtab, &ambiance_msgtab, &fsay_msgtab, &faction_msgtab, &npc_msgtab, &npca_msgtab, &roleplay_msgtab, NULL };
|
||||
|
||||
|
@ -98,118 +98,112 @@ DECLARE_MODULE_AV1(roleplay, _modinit, _moddeinit, roleplay_clist, NULL, NULL, "
|
|||
static int
|
||||
m_scene(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
m_displaymsg(source_p, parv[1], 0, 0, "=Scene=", parv[2]);
|
||||
return 0;
|
||||
m_displaymsg(source_p, parv[1], 0, 0, "=Scene=", parv[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
m_fsay(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
m_displaymsg(source_p, parv[1], 0, 0, parv[2], parv[3]);
|
||||
return 0;
|
||||
m_displaymsg(source_p, parv[1], 0, 0, parv[2], parv[3]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
m_faction(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
m_displaymsg(source_p, parv[1], 0, 1, parv[2], parv[3]);
|
||||
return 0;
|
||||
m_displaymsg(source_p, parv[1], 0, 1, parv[2], parv[3]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
m_npc(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
m_displaymsg(source_p, parv[1], 1, 0, parv[2], parv[3]);
|
||||
return 0;
|
||||
m_displaymsg(source_p, parv[1], 1, 0, parv[2], parv[3]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
m_npca(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
m_displaymsg(source_p, parv[1], 1, 1, parv[2], parv[3]);
|
||||
return 0;
|
||||
m_displaymsg(source_p, parv[1], 1, 1, parv[2], parv[3]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
m_displaymsg(struct Client *source_p, const char *channel, int underline, int action, const char *nick, const char *text)
|
||||
{
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
char nick2[NICKLEN+1];
|
||||
char *nick3 = rb_strdup(nick);
|
||||
char text2[BUFSIZE];
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
char nick2[NICKLEN+1];
|
||||
char *nick3 = rb_strdup(nick);
|
||||
char text2[BUFSIZE];
|
||||
|
||||
if((chptr = find_channel(channel)) == NULL)
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), channel);
|
||||
return 0;
|
||||
}
|
||||
if((chptr = find_channel(channel)) == NULL) {
|
||||
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), channel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!(msptr = find_channel_membership(chptr, source_p)))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
|
||||
form_str(ERR_NOTONCHANNEL), chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
if(!(msptr = find_channel_membership(chptr, source_p))) {
|
||||
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
|
||||
form_str(ERR_NOTONCHANNEL), chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!(chptr->mode.mode & chmode_flags['N']))
|
||||
{
|
||||
sendto_one_numeric(source_p, 573, "%s :Roleplay commands are not enabled on this channel.", chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
if(!(chptr->mode.mode & chmode_flags['N'])) {
|
||||
sendto_one_numeric(source_p, 573, "%s :Roleplay commands are not enabled on this channel.", chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!can_send(chptr, source_p, msptr))
|
||||
{
|
||||
sendto_one_numeric(source_p, 573, "%s :Cannot send to channel.", chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
if(!can_send(chptr, source_p, msptr)) {
|
||||
sendto_one_numeric(source_p, 573, "%s :Cannot send to channel.", chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* enforce flood stuff on roleplay commands */
|
||||
if(flood_attack_channel(0, source_p, chptr, chptr->chname))
|
||||
return 0;
|
||||
/* enforce flood stuff on roleplay commands */
|
||||
if(flood_attack_channel(0, source_p, chptr, chptr->chname))
|
||||
return 0;
|
||||
|
||||
/* enforce target change on roleplay commands */
|
||||
if(!is_chanop_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_TARGCHANGE),
|
||||
me.name, source_p->name, chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
/* enforce target change on roleplay commands */
|
||||
if(!is_chanop_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr)) {
|
||||
sendto_one(source_p, form_str(ERR_TARGCHANGE),
|
||||
me.name, source_p->name, chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(underline)
|
||||
rb_snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3));
|
||||
else
|
||||
rb_snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3));
|
||||
if(underline)
|
||||
snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3));
|
||||
else
|
||||
snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3));
|
||||
|
||||
/* don't allow nicks to be empty after stripping
|
||||
* this prevents nastiness like fake factions, etc. */
|
||||
if(EmptyString(nick3))
|
||||
{
|
||||
sendto_one_numeric(source_p, 573, "%s :No visible non-stripped characters in nick.", chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
/* don't allow nicks to be empty after stripping
|
||||
* this prevents nastiness like fake factions, etc. */
|
||||
if(EmptyString(nick3)) {
|
||||
sendto_one_numeric(source_p, 573, "%s :No visible non-stripped characters in nick.", chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(action)
|
||||
rb_snprintf(text2, sizeof(text2), "\1ACTION %s\1", text);
|
||||
else
|
||||
rb_snprintf(text2, sizeof(text2), "%s", text);
|
||||
if(action)
|
||||
snprintf(text2, sizeof(text2), "\1ACTION %s\1", text);
|
||||
else
|
||||
snprintf(text2, sizeof(text2), "%s", text);
|
||||
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", nick2, source_p->name, channel, text2);
|
||||
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",
|
||||
channel, nick2, text2);
|
||||
return 0;
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s (%s)", nick2, source_p->name, channel, text2, source_p->name);
|
||||
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",
|
||||
channel, nick2, text2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
me_roleplay(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr;
|
||||
struct Channel *chptr;
|
||||
|
||||
/* Don't segfault if we get ROLEPLAY with an invalid channel.
|
||||
* This shouldn't happen but it's best to be on the safe side. */
|
||||
if((chptr = find_channel(parv[1])) == NULL)
|
||||
return 0;
|
||||
/* Don't segfault if we get ROLEPLAY with an invalid channel.
|
||||
* This shouldn't happen but it's best to be on the safe side. */
|
||||
if((chptr = find_channel(parv[1])) == NULL)
|
||||
return 0;
|
||||
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", parv[2], source_p->name, parv[1], parv[3]);
|
||||
return 0;
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s (%s)", parv[2], source_p->name, parv[1], parv[3], source_p->name);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,130 +46,120 @@
|
|||
static int mo_sendbans(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
||||
|
||||
struct Message sendbans_msgtab = {
|
||||
"SENDBANS", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_sendbans, 2}}
|
||||
"SENDBANS", 0, 0, 0, MFLG_SLOW,
|
||||
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_sendbans, 2}}
|
||||
};
|
||||
|
||||
mapi_clist_av1 sendbans_clist[] = {
|
||||
&sendbans_msgtab,
|
||||
NULL
|
||||
&sendbans_msgtab,
|
||||
NULL
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(sendbans, NULL, NULL, sendbans_clist, NULL, NULL, "$Revision$");
|
||||
|
||||
static const char *expand_xline(const char *mask)
|
||||
{
|
||||
static char buf[512];
|
||||
const char *p;
|
||||
char *q;
|
||||
static char buf[512];
|
||||
const char *p;
|
||||
char *q;
|
||||
|
||||
if (!strchr(mask, ' '))
|
||||
return mask;
|
||||
if (strlen(mask) > 250)
|
||||
return NULL;
|
||||
p = mask;
|
||||
q = buf;
|
||||
while (*p != '\0')
|
||||
{
|
||||
if (*p == ' ')
|
||||
*q++ = '\\', *q++ = 's';
|
||||
else
|
||||
*q++ = *p;
|
||||
p++;
|
||||
}
|
||||
*q = '\0';
|
||||
return buf;
|
||||
if (!strchr(mask, ' '))
|
||||
return mask;
|
||||
if (strlen(mask) > 250)
|
||||
return NULL;
|
||||
p = mask;
|
||||
q = buf;
|
||||
while (*p != '\0') {
|
||||
if (*p == ' ')
|
||||
*q++ = '\\', *q++ = 's';
|
||||
else
|
||||
*q++ = *p;
|
||||
p++;
|
||||
}
|
||||
*q = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
static int mo_sendbans(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct ConfItem *aconf;
|
||||
rb_dlink_node *ptr;
|
||||
int i, count;
|
||||
const char *target, *mask2;
|
||||
struct Client *server_p;
|
||||
struct ConfItem *aconf;
|
||||
rb_dlink_node *ptr;
|
||||
int i, count;
|
||||
const char *target, *mask2;
|
||||
struct Client *server_p;
|
||||
|
||||
if (!IsOperRemoteBan(source_p))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
||||
me.name, source_p->name, "remoteban");
|
||||
return 0;
|
||||
}
|
||||
if (!IsOperXline(source_p))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
||||
me.name, source_p->name, "xline");
|
||||
return 0;
|
||||
}
|
||||
if (!IsOperResv(source_p))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
||||
me.name, source_p->name, "resv");
|
||||
return 0;
|
||||
}
|
||||
if (!IsOperRemoteBan(source_p)) {
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
||||
me.name, source_p->name, "remoteban");
|
||||
return 0;
|
||||
}
|
||||
if (!IsOperXline(source_p)) {
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
||||
me.name, source_p->name, "xline");
|
||||
return 0;
|
||||
}
|
||||
if (!IsOperResv(source_p)) {
|
||||
sendto_one(source_p, form_str(ERR_NOPRIVS),
|
||||
me.name, source_p->name, "resv");
|
||||
return 0;
|
||||
}
|
||||
|
||||
target = parv[1];
|
||||
count = 0;
|
||||
RB_DLINK_FOREACH(ptr, global_serv_list.head)
|
||||
{
|
||||
server_p = ptr->data;
|
||||
if (IsMe(server_p))
|
||||
continue;
|
||||
if (match(target, server_p->name))
|
||||
count++;
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
|
||||
form_str(ERR_NOSUCHSERVER), target);
|
||||
return 0;
|
||||
}
|
||||
target = parv[1];
|
||||
count = 0;
|
||||
RB_DLINK_FOREACH(ptr, global_serv_list.head) {
|
||||
server_p = ptr->data;
|
||||
if (IsMe(server_p))
|
||||
continue;
|
||||
if (match(target, server_p->name))
|
||||
count++;
|
||||
}
|
||||
if (count == 0) {
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
|
||||
form_str(ERR_NOSUCHSERVER), target);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
|
||||
"%s!%s@%s is sending resvs and xlines to %s",
|
||||
source_p->name, source_p->username, source_p->host,
|
||||
target);
|
||||
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
|
||||
"%s!%s@%s is sending resvs and xlines to %s",
|
||||
source_p->name, source_p->username, source_p->host,
|
||||
target);
|
||||
|
||||
RB_DLINK_FOREACH(ptr, resv_conf_list.head)
|
||||
{
|
||||
aconf = ptr->data;
|
||||
if (aconf->hold)
|
||||
continue;
|
||||
sendto_match_servs(source_p, target,
|
||||
CAP_ENCAP, NOCAPS,
|
||||
"ENCAP %s RESV 0 %s 0 :%s",
|
||||
target, aconf->host, aconf->passwd);
|
||||
}
|
||||
RB_DLINK_FOREACH(ptr, resv_conf_list.head) {
|
||||
aconf = ptr->data;
|
||||
if (aconf->hold)
|
||||
continue;
|
||||
sendto_match_servs(source_p, target,
|
||||
CAP_ENCAP, NOCAPS,
|
||||
"ENCAP %s RESV 0 %s 0 :%s",
|
||||
target, aconf->host, aconf->passwd);
|
||||
}
|
||||
|
||||
HASH_WALK(i, R_MAX, ptr, resvTable)
|
||||
{
|
||||
aconf = ptr->data;
|
||||
if (aconf->hold)
|
||||
continue;
|
||||
sendto_match_servs(source_p, target,
|
||||
CAP_ENCAP, NOCAPS,
|
||||
"ENCAP %s RESV 0 %s 0 :%s",
|
||||
target, aconf->host, aconf->passwd);
|
||||
}
|
||||
HASH_WALK_END
|
||||
HASH_WALK(i, R_MAX, ptr, resvTable) {
|
||||
aconf = ptr->data;
|
||||
if (aconf->hold)
|
||||
continue;
|
||||
sendto_match_servs(source_p, target,
|
||||
CAP_ENCAP, NOCAPS,
|
||||
"ENCAP %s RESV 0 %s 0 :%s",
|
||||
target, aconf->host, aconf->passwd);
|
||||
}
|
||||
HASH_WALK_END
|
||||
|
||||
RB_DLINK_FOREACH(ptr, xline_conf_list.head)
|
||||
{
|
||||
aconf = ptr->data;
|
||||
if (aconf->hold)
|
||||
continue;
|
||||
mask2 = expand_xline(aconf->host);
|
||||
if (mask2 == NULL)
|
||||
{
|
||||
sendto_one_notice(source_p, ":Skipping xline [%s]",
|
||||
aconf->host);
|
||||
continue;
|
||||
}
|
||||
sendto_match_servs(source_p, target,
|
||||
CAP_ENCAP, NOCAPS,
|
||||
"ENCAP %s XLINE 0 %s 2 :%s",
|
||||
target, mask2, aconf->passwd);
|
||||
}
|
||||
RB_DLINK_FOREACH(ptr, xline_conf_list.head) {
|
||||
aconf = ptr->data;
|
||||
if (aconf->hold)
|
||||
continue;
|
||||
mask2 = expand_xline(aconf->host);
|
||||
if (mask2 == NULL) {
|
||||
sendto_one_notice(source_p, ":Skipping xline [%s]",
|
||||
aconf->host);
|
||||
continue;
|
||||
}
|
||||
sendto_match_servs(source_p, target,
|
||||
CAP_ENCAP, NOCAPS,
|
||||
"ENCAP %s XLINE 0 %s 2 :%s",
|
||||
target, mask2, aconf->passwd);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
static int mr_webirc(struct Client *, struct Client *, int, const char **);
|
||||
|
||||
struct Message webirc_msgtab = {
|
||||
"WEBIRC", 0, 0, 0, MFLG_SLOW | MFLG_UNREG,
|
||||
{{mr_webirc, 5}, mg_reg, mg_ignore, mg_ignore, mg_ignore, mg_reg}
|
||||
"WEBIRC", 0, 0, 0, MFLG_SLOW | MFLG_UNREG,
|
||||
{{mr_webirc, 5}, mg_reg, mg_ignore, mg_ignore, mg_ignore, mg_reg}
|
||||
};
|
||||
|
||||
mapi_clist_av1 webirc_clist[] = { &webirc_msgtab, NULL };
|
||||
|
@ -68,74 +68,68 @@ DECLARE_MODULE_AV1(webirc, NULL, NULL, webirc_clist, NULL, NULL, "$Revision: 207
|
|||
* mr_webirc - webirc message handler
|
||||
* parv[1] = password
|
||||
* parv[2] = fake username (we ignore this)
|
||||
* parv[3] = fake hostname
|
||||
* parv[3] = fake hostname
|
||||
* parv[4] = fake ip
|
||||
*/
|
||||
static int
|
||||
mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct ConfItem *aconf;
|
||||
const char *encr;
|
||||
struct ConfItem *aconf;
|
||||
const char *encr;
|
||||
|
||||
if (!strchr(parv[4], '.') && !strchr(parv[4], ':'))
|
||||
{
|
||||
sendto_one(source_p, "NOTICE * :Invalid IP");
|
||||
return 0;
|
||||
}
|
||||
if (!strchr(parv[4], '.') && !strchr(parv[4], ':')) {
|
||||
sendto_one(source_p, "NOTICE * :Invalid IP");
|
||||
return 0;
|
||||
}
|
||||
|
||||
aconf = find_address_conf(client_p->host, client_p->sockhost,
|
||||
IsGotId(client_p) ? client_p->username : "webirc",
|
||||
IsGotId(client_p) ? client_p->username : "webirc",
|
||||
(struct sockaddr *) &client_p->localClient->ip,
|
||||
client_p->localClient->ip.ss_family, NULL);
|
||||
if (aconf == NULL || !(aconf->status & CONF_CLIENT))
|
||||
return 0;
|
||||
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc."))
|
||||
{
|
||||
/* XXX */
|
||||
sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block");
|
||||
return 0;
|
||||
}
|
||||
if (EmptyString(aconf->passwd))
|
||||
{
|
||||
sendto_one(source_p, "NOTICE * :CGI:IRC auth blocks must have a password");
|
||||
return 0;
|
||||
}
|
||||
aconf = find_address_conf(client_p->host, client_p->sockhost,
|
||||
IsGotId(client_p) ? client_p->username : "webirc",
|
||||
IsGotId(client_p) ? client_p->username : "webirc",
|
||||
(struct sockaddr *) &client_p->localClient->ip,
|
||||
client_p->localClient->ip.ss_family, NULL);
|
||||
if (aconf == NULL || !(aconf->status & CONF_CLIENT))
|
||||
return 0;
|
||||
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc.")) {
|
||||
/* XXX */
|
||||
sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block");
|
||||
return 0;
|
||||
}
|
||||
if (EmptyString(aconf->passwd)) {
|
||||
sendto_one(source_p, "NOTICE * :CGI:IRC auth blocks must have a password");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (EmptyString(parv[1]))
|
||||
encr = "";
|
||||
else if (IsConfEncrypted(aconf))
|
||||
encr = rb_crypt(parv[1], aconf->passwd);
|
||||
else
|
||||
encr = parv[1];
|
||||
if (EmptyString(parv[1]))
|
||||
encr = "";
|
||||
else if (IsConfEncrypted(aconf))
|
||||
encr = rb_crypt(parv[1], aconf->passwd);
|
||||
else
|
||||
encr = parv[1];
|
||||
|
||||
if (strcmp(encr, aconf->passwd))
|
||||
{
|
||||
sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect");
|
||||
return 0;
|
||||
}
|
||||
if (strcmp(encr, aconf->passwd)) {
|
||||
sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
rb_strlcpy(source_p->sockhost, parv[4], sizeof(source_p->sockhost));
|
||||
rb_strlcpy(source_p->sockhost, parv[4], sizeof(source_p->sockhost));
|
||||
|
||||
if(strlen(parv[3]) <= HOSTLEN)
|
||||
rb_strlcpy(source_p->host, parv[3], sizeof(source_p->host));
|
||||
else
|
||||
rb_strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host));
|
||||
|
||||
rb_inet_pton_sock(parv[4], (struct sockaddr *)&source_p->localClient->ip);
|
||||
if(strlen(parv[3]) <= HOSTLEN)
|
||||
rb_strlcpy(source_p->host, parv[3], sizeof(source_p->host));
|
||||
else
|
||||
rb_strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host));
|
||||
|
||||
/* Check dlines now, klines will be checked on registration */
|
||||
if((aconf = find_dline((struct sockaddr *)&source_p->localClient->ip,
|
||||
source_p->localClient->ip.ss_family)))
|
||||
{
|
||||
if(!(aconf->status & CONF_EXEMPTDLINE))
|
||||
{
|
||||
exit_client(client_p, source_p, &me, "D-lined");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
rb_inet_pton_sock(parv[4], (struct sockaddr *)&source_p->localClient->ip);
|
||||
|
||||
sendto_one(source_p, "NOTICE * :CGI:IRC host/IP set to %s %s", parv[3], parv[4]);
|
||||
return 0;
|
||||
/* Check dlines now, klines will be checked on registration */
|
||||
if((aconf = find_dline((struct sockaddr *)&source_p->localClient->ip,
|
||||
source_p->localClient->ip.ss_family))) {
|
||||
if(!(aconf->status & CONF_EXEMPTDLINE)) {
|
||||
exit_client(client_p, source_p, &me, "D-lined");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sendto_one(source_p, "NOTICE * :CGI:IRC host/IP set to %s %s", parv[3], parv[4]);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
static void h_nl_umode_changed(hook_data_umode_changed *);
|
||||
|
||||
mapi_hfn_list_av1 nl_hfnlist[] = {
|
||||
{ "umode_changed", (hookfn) h_nl_umode_changed },
|
||||
{ NULL, NULL }
|
||||
{ "umode_changed", (hookfn) h_nl_umode_changed },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(no_locops, NULL, NULL, NULL, NULL, nl_hfnlist, "$Revision: 3219 $");
|
||||
|
@ -24,10 +24,9 @@ DECLARE_MODULE_AV1(no_locops, NULL, NULL, NULL, NULL, nl_hfnlist, "$Revision: 32
|
|||
static void
|
||||
h_nl_umode_changed(hook_data_umode_changed *hdata)
|
||||
{
|
||||
struct Client *source_p = hdata->client;
|
||||
struct Client *source_p = hdata->client;
|
||||
|
||||
if (MyClient(source_p) && source_p->umodes & UMODE_LOCOPS)
|
||||
{
|
||||
source_p->umodes &= ~UMODE_LOCOPS;
|
||||
}
|
||||
if (MyClient(source_p) && source_p->umodes & UMODE_LOCOPS) {
|
||||
source_p->umodes &= ~UMODE_LOCOPS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,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(no_oper_invis, NULL, NULL, NULL, NULL, noi_hfnlist, "$Revision: 3219 $");
|
||||
|
@ -26,15 +26,14 @@ DECLARE_MODULE_AV1(no_oper_invis, NULL, NULL, NULL, NULL, noi_hfnlist, "$Revisio
|
|||
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) && !IsOperInvis(source_p) &&
|
||||
IsInvisible(source_p))
|
||||
{
|
||||
ClearInvisible(source_p);
|
||||
/* If they tried /umode +i, complain; do not complain
|
||||
* if they opered up while invisible -- jilles */
|
||||
if (hdata->oldumodes & UMODE_OPER)
|
||||
sendto_one_notice(source_p, ":*** Opers may not set themselves invisible");
|
||||
}
|
||||
if (MyClient(source_p) && IsOper(source_p) && !IsOperInvis(source_p) &&
|
||||
IsInvisible(source_p)) {
|
||||
ClearInvisible(source_p);
|
||||
/* If they tried /umode +i, complain; do not complain
|
||||
* if they opered up while invisible -- jilles */
|
||||
if (hdata->oldumodes & UMODE_OPER)
|
||||
sendto_one_notice(source_p, ":*** Opers may not set themselves invisible");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ static void h_gcn_new_remote_user(struct Client *);
|
|||
static void h_gcn_client_exit(hook_data_client_exit *);
|
||||
|
||||
mapi_hfn_list_av1 gcn_hfnlist[] = {
|
||||
{ "new_remote_user", (hookfn) h_gcn_new_remote_user },
|
||||
{ "client_exit", (hookfn) h_gcn_client_exit },
|
||||
{ NULL, NULL }
|
||||
{ "new_remote_user", (hookfn) h_gcn_new_remote_user },
|
||||
{ "client_exit", (hookfn) h_gcn_client_exit },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(globalconnexit, _modinit, _moddeinit, NULL, NULL, gcn_hfnlist, "$Revision: 1869 $");
|
||||
|
@ -32,49 +32,49 @@ DECLARE_MODULE_AV1(globalconnexit, _modinit, _moddeinit, NULL, NULL, gcn_hfnlist
|
|||
static int
|
||||
_modinit(void)
|
||||
{
|
||||
/* add the snomask to the available slot */
|
||||
snomask_modes['F'] = find_snomask_slot();
|
||||
/* add the snomask to the available slot */
|
||||
snomask_modes['F'] = find_snomask_slot();
|
||||
|
||||
/* show the fact that we are showing user information in /version */
|
||||
opers_see_all_users = 1;
|
||||
/* show the fact that we are showing user information in /version */
|
||||
opers_see_all_users = 1;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_moddeinit(void)
|
||||
{
|
||||
/* disable the snomask and remove it from the available list */
|
||||
snomask_modes['F'] = 0;
|
||||
/* disable the snomask and remove it from the available list */
|
||||
snomask_modes['F'] = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
h_gcn_new_remote_user(struct Client *source_p)
|
||||
{
|
||||
|
||||
if (!HasSentEob(source_p->servptr))
|
||||
return;
|
||||
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
|
||||
"Client connecting: %s (%s@%s) [%s] {%s} [%s]",
|
||||
source_p->name, source_p->username, source_p->orighost,
|
||||
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255",
|
||||
"?", source_p->info);
|
||||
if (!HasSentEob(source_p->servptr))
|
||||
return;
|
||||
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
|
||||
"Client connecting: %s (%s@%s) [%s] {%s} [%s]",
|
||||
source_p->name, source_p->username, source_p->orighost,
|
||||
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255",
|
||||
"?", source_p->info);
|
||||
}
|
||||
|
||||
static void
|
||||
h_gcn_client_exit(hook_data_client_exit *hdata)
|
||||
{
|
||||
struct Client *source_p;
|
||||
struct Client *source_p;
|
||||
|
||||
source_p = hdata->target;
|
||||
source_p = hdata->target;
|
||||
|
||||
if (MyConnect(source_p) || !IsClient(source_p))
|
||||
return;
|
||||
if (!HasSentEob(source_p->servptr))
|
||||
return;
|
||||
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
|
||||
"Client exiting: %s (%s@%s) [%s] [%s]",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, hdata->comment,
|
||||
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255");
|
||||
if (MyConnect(source_p) || !IsClient(source_p))
|
||||
return;
|
||||
if (!HasSentEob(source_p->servptr))
|
||||
return;
|
||||
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
|
||||
"Client exiting: %s (%s@%s) [%s] [%s]",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, hdata->comment,
|
||||
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255");
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
static void h_gla_client_exit(hook_data_client_exit *);
|
||||
|
||||
mapi_hfn_list_av1 gla_hfnlist[] = {
|
||||
{ "client_exit", (hookfn) h_gla_client_exit },
|
||||
{ NULL, NULL }
|
||||
{ "client_exit", (hookfn) h_gla_client_exit },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, "$Revision: 613 $");
|
||||
|
@ -28,35 +28,28 @@ DECLARE_MODULE_AV1(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, "$Revi
|
|||
static void
|
||||
h_gla_client_exit(hook_data_client_exit *hdata)
|
||||
{
|
||||
struct Client *source_p;
|
||||
struct Client *source_p;
|
||||
|
||||
source_p = hdata->target;
|
||||
source_p = hdata->target;
|
||||
|
||||
if (MyConnect(source_p) || !IsClient(source_p))
|
||||
return;
|
||||
if (!strcmp(hdata->comment, "Bad user info"))
|
||||
{
|
||||
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
|
||||
"XLINE active for %s[%s@%s]",
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
}
|
||||
else if (ConfigFileEntry.kline_reason != NULL &&
|
||||
!strcmp(hdata->comment, ConfigFileEntry.kline_reason))
|
||||
{
|
||||
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
|
||||
"K/DLINE active for %s[%s@%s]",
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
}
|
||||
else if (!strncmp(hdata->comment, "Temporary K-line ", 17))
|
||||
{
|
||||
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
|
||||
"K/DLINE active for %s[%s@%s]",
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
}
|
||||
else if (!strncmp(hdata->comment, "Temporary D-line ", 17))
|
||||
{
|
||||
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
|
||||
"K/DLINE active for %s[%s@%s]",
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
}
|
||||
if (MyConnect(source_p) || !IsClient(source_p))
|
||||
return;
|
||||
if (!strcmp(hdata->comment, "Bad user info")) {
|
||||
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
|
||||
"XLINE active for %s[%s@%s]",
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
} else if (ConfigFileEntry.kline_reason != NULL &&
|
||||
!strcmp(hdata->comment, ConfigFileEntry.kline_reason)) {
|
||||
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
|
||||
"K/DLINE active for %s[%s@%s]",
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
} else if (!strncmp(hdata->comment, "Temporary K-line ", 17)) {
|
||||
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
|
||||
"K/DLINE active for %s[%s@%s]",
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
} else if (!strncmp(hdata->comment, "Temporary D-line ", 17)) {
|
||||
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
|
||||
"K/DLINE active for %s[%s@%s]",
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
static void h_sgo_umode_changed(void *);
|
||||
|
||||
mapi_hfn_list_av1 sgo_hfnlist[] = {
|
||||
{ "umode_changed", (hookfn) h_sgo_umode_changed },
|
||||
{ NULL, NULL }
|
||||
{ "umode_changed", (hookfn) h_sgo_umode_changed },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(sno_globaloper, NULL, NULL, NULL, NULL, sgo_hfnlist, "$Revision: 639 $");
|
||||
|
@ -24,14 +24,14 @@ DECLARE_MODULE_AV1(sno_globaloper, NULL, NULL, NULL, NULL, sgo_hfnlist, "$Revisi
|
|||
static void
|
||||
h_sgo_umode_changed(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 (MyConnect(source_p) || !HasSentEob(source_p->servptr))
|
||||
return;
|
||||
if (MyConnect(source_p) || !HasSentEob(source_p->servptr))
|
||||
return;
|
||||
|
||||
if (!(data->oldumodes & UMODE_OPER) && IsOper(source_p))
|
||||
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
|
||||
"%s (%s@%s) is now an operator",
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
if (!(data->oldumodes & UMODE_OPER) && IsOper(source_p))
|
||||
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
|
||||
"%s (%s@%s) is now an operator",
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
}
|
||||
|
|
|
@ -20,23 +20,23 @@
|
|||
void show_whois(hook_data_client *);
|
||||
|
||||
mapi_hfn_list_av1 whois_hfnlist[] = {
|
||||
{"doing_whois", (hookfn) show_whois},
|
||||
{"doing_whois_global", (hookfn) show_whois},
|
||||
{NULL, NULL}
|
||||
{"doing_whois", (hookfn) show_whois},
|
||||
{"doing_whois_global", (hookfn) show_whois},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static int
|
||||
init(void)
|
||||
{
|
||||
snomask_modes['W'] = find_snomask_slot();
|
||||
snomask_modes['W'] = find_snomask_slot();
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
fini(void)
|
||||
{
|
||||
snomask_modes['W'] = find_snomask_slot();
|
||||
snomask_modes['W'] = find_snomask_slot();
|
||||
}
|
||||
|
||||
DECLARE_MODULE_AV1(sno_whois, init, fini, NULL, NULL, whois_hfnlist, "$Revision: 3498 $");
|
||||
|
@ -44,20 +44,19 @@ DECLARE_MODULE_AV1(sno_whois, init, fini, NULL, NULL, whois_hfnlist, "$Revision:
|
|||
void
|
||||
show_whois(hook_data_client *data)
|
||||
{
|
||||
struct Client *source_p = data->client;
|
||||
struct Client *target_p = data->target;
|
||||
struct Client *source_p = data->client;
|
||||
struct Client *target_p = data->target;
|
||||
|
||||
if(MyClient(target_p) &&
|
||||
if(MyClient(target_p) &&
|
||||
#ifdef OPERONLY
|
||||
IsOper(target_p) &&
|
||||
IsOper(target_p) &&
|
||||
#endif
|
||||
(source_p != target_p) &&
|
||||
(target_p->snomask & snomask_modes['W']))
|
||||
{
|
||||
sendto_one_notice(target_p,
|
||||
":*** Notice -- %s (%s@%s) is doing a whois on you [%s]",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host,
|
||||
source_p->servptr->name);
|
||||
}
|
||||
(source_p != target_p) &&
|
||||
(target_p->snomask & snomask_modes['W'])) {
|
||||
sendto_one_notice(target_p,
|
||||
":*** Notice -- %s (%s@%s) is doing a whois on you [%s]",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host,
|
||||
source_p->servptr->name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
void show_admin(hook_data *);
|
||||
|
||||
mapi_hfn_list_av1 admin_hfnlist[] = {
|
||||
{"doing_admin", (hookfn) show_admin},
|
||||
{NULL, NULL}
|
||||
{"doing_admin", (hookfn) show_admin},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(admin_spy, NULL, NULL, NULL, NULL, admin_hfnlist, "$Revision: 498 $");
|
||||
|
@ -39,8 +39,8 @@ DECLARE_MODULE_AV1(admin_spy, NULL, NULL, NULL, NULL, admin_hfnlist, "$Revision:
|
|||
void
|
||||
show_admin(hook_data *data)
|
||||
{
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"admin requested by %s (%s@%s) [%s]",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"admin requested by %s (%s@%s) [%s]",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
void show_info(hook_data *);
|
||||
|
||||
mapi_hfn_list_av1 info_hfnlist[] = {
|
||||
{"doing_info", (hookfn) show_info},
|
||||
{NULL, NULL}
|
||||
{"doing_info", (hookfn) show_info},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(info_spy, NULL, NULL, NULL, NULL, info_hfnlist, "$Revision: 498 $");
|
||||
|
@ -39,8 +39,8 @@ DECLARE_MODULE_AV1(info_spy, NULL, NULL, NULL, NULL, info_hfnlist, "$Revision: 4
|
|||
void
|
||||
show_info(hook_data *data)
|
||||
{
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"info requested by %s (%s@%s) [%s]",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"info requested by %s (%s@%s) [%s]",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
void show_links(hook_data *);
|
||||
|
||||
mapi_hfn_list_av1 links_hfnlist[] = {
|
||||
{"doing_links", (hookfn) show_links},
|
||||
{NULL, NULL}
|
||||
{"doing_links", (hookfn) show_links},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(links_spy, NULL, NULL, NULL, NULL, links_hfnlist, "$Revision: 498 $");
|
||||
|
@ -39,10 +39,10 @@ DECLARE_MODULE_AV1(links_spy, NULL, NULL, NULL, NULL, links_hfnlist, "$Revision:
|
|||
void
|
||||
show_links(hook_data *data)
|
||||
{
|
||||
const char *mask = data->arg1;
|
||||
const char *mask = data->arg1;
|
||||
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"LINKS '%s' requested by %s (%s@%s) [%s]",
|
||||
mask, data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"LINKS '%s' requested by %s (%s@%s) [%s]",
|
||||
mask, data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
void show_motd(hook_data *);
|
||||
|
||||
mapi_hfn_list_av1 motd_hfnlist[] = {
|
||||
{"doing_motd", (hookfn) show_motd},
|
||||
{NULL, NULL}
|
||||
{"doing_motd", (hookfn) show_motd},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(motd_spy, NULL, NULL, NULL, NULL, motd_hfnlist, "$Revision: 498 $");
|
||||
|
@ -39,8 +39,8 @@ DECLARE_MODULE_AV1(motd_spy, NULL, NULL, NULL, NULL, motd_hfnlist, "$Revision: 4
|
|||
void
|
||||
show_motd(hook_data *data)
|
||||
{
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"motd requested by %s (%s@%s) [%s]",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"motd requested by %s (%s@%s) [%s]",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
void show_stats(hook_data_int *);
|
||||
|
||||
mapi_hfn_list_av1 stats_hfnlist[] = {
|
||||
{"doing_stats", (hookfn) show_stats},
|
||||
{NULL, NULL}
|
||||
{"doing_stats", (hookfn) show_stats},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(stats_spy, NULL, NULL, NULL, NULL, stats_hfnlist, "$Revision: 498 $");
|
||||
|
@ -39,31 +39,28 @@ DECLARE_MODULE_AV1(stats_spy, NULL, NULL, NULL, NULL, stats_hfnlist, "$Revision:
|
|||
void
|
||||
show_stats(hook_data_int *data)
|
||||
{
|
||||
char statchar = (char) data->arg2;
|
||||
char statchar = (char) data->arg2;
|
||||
|
||||
if(statchar == 'L' || statchar == 'l')
|
||||
{
|
||||
const char *name = data->arg1;
|
||||
if(statchar == 'L' || statchar == 'l') {
|
||||
const char *name = data->arg1;
|
||||
|
||||
if(!EmptyString(name))
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"STATS %c requested by %s (%s@%s) [%s] on %s",
|
||||
statchar, data->client->name,
|
||||
data->client->username,
|
||||
data->client->host,
|
||||
data->client->servptr->name, name);
|
||||
else
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"STATS %c requested by %s (%s@%s) [%s]",
|
||||
statchar, data->client->name,
|
||||
data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"STATS %c requested by %s (%s@%s) [%s]",
|
||||
statchar, data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
}
|
||||
if(!EmptyString(name))
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"STATS %c requested by %s (%s@%s) [%s] on %s",
|
||||
statchar, data->client->name,
|
||||
data->client->username,
|
||||
data->client->host,
|
||||
data->client->servptr->name, name);
|
||||
else
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"STATS %c requested by %s (%s@%s) [%s]",
|
||||
statchar, data->client->name,
|
||||
data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
} else {
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"STATS %c requested by %s (%s@%s) [%s]",
|
||||
statchar, data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
void show_stats_p(hook_data *);
|
||||
|
||||
mapi_hfn_list_av1 stats_p_hfnlist[] = {
|
||||
{"doing_stats_p", (hookfn) show_stats_p},
|
||||
{NULL, NULL}
|
||||
{"doing_stats_p", (hookfn) show_stats_p},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(stats_p_spy, NULL, NULL, NULL, NULL, stats_p_hfnlist, "$Revision: 498 $");
|
||||
|
@ -39,8 +39,8 @@ DECLARE_MODULE_AV1(stats_p_spy, NULL, NULL, NULL, NULL, stats_p_hfnlist, "$Revis
|
|||
void
|
||||
show_stats_p(hook_data *data)
|
||||
{
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"STATS p requested by %s (%s@%s) [%s]",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"STATS p requested by %s (%s@%s) [%s]",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
void show_trace(hook_data_client *);
|
||||
|
||||
mapi_hfn_list_av1 trace_hfnlist[] = {
|
||||
{"doing_trace", (hookfn) show_trace},
|
||||
{NULL, NULL}
|
||||
{"doing_trace", (hookfn) show_trace},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DECLARE_MODULE_AV1(trace_spy, NULL, NULL, NULL, NULL, trace_hfnlist, "$Revision: 498 $");
|
||||
|
@ -39,15 +39,15 @@ DECLARE_MODULE_AV1(trace_spy, NULL, NULL, NULL, NULL, trace_hfnlist, "$Revision:
|
|||
void
|
||||
show_trace(hook_data_client *data)
|
||||
{
|
||||
if(data->target)
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"trace requested by %s (%s@%s) [%s] on %s",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name,
|
||||
data->target->name);
|
||||
else
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"trace requested by %s (%s@%s) [%s]",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
if(data->target)
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"trace requested by %s (%s@%s) [%s] on %s",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name,
|
||||
data->target->name);
|
||||
else
|
||||
sendto_realops_snomask(SNO_SPY, L_ALL,
|
||||
"trace requested by %s (%s@%s) [%s]",
|
||||
data->client->name, data->client->username,
|
||||
data->client->host, data->client->servptr->name);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
setuser ircd /home/ircd/run/bin/ircd -foreground
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,414 @@
|
|||
/* Elemental-IRCd functions
|
||||
*
|
||||
* (C) 2014 Sam Dodrill <shadowh511@gmail.com>
|
||||
* (C) 2003-2014 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "modules/cs_mode.h"
|
||||
#include "modules/sasl.h"
|
||||
|
||||
static Anope::string UplinkSID;
|
||||
|
||||
static ServiceReference<IRCDProto> ratbox("IRCDProto", "ratbox");
|
||||
|
||||
class ChannelModeLargeBan : public ChannelMode
|
||||
{
|
||||
public:
|
||||
ChannelModeLargeBan(const Anope::string &mname, char modeChar) : ChannelMode(mname, modeChar) { }
|
||||
|
||||
bool CanSet(User *u) const anope_override
|
||||
{
|
||||
return u && u->HasMode("OPER");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ElementalProto : public IRCDProto
|
||||
{
|
||||
public:
|
||||
ElementalProto(Module *creator) : IRCDProto(creator, "Elemental-IRCd 6.5+")
|
||||
{
|
||||
DefaultPseudoclientModes = "+oiS";
|
||||
CanCertFP = true;
|
||||
CanSNLine = true;
|
||||
CanSQLine = true;
|
||||
CanSZLine = true;
|
||||
CanSVSNick = true;
|
||||
CanSVSHold = true;
|
||||
CanSetVHost = true;
|
||||
RequiresID = true;
|
||||
MaxModes = 4;
|
||||
}
|
||||
|
||||
void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) anope_override { ratbox->SendSVSKillInternal(source, targ, reason); }
|
||||
void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { ratbox->SendGlobalNotice(bi, dest, msg); }
|
||||
void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { ratbox->SendGlobalPrivmsg(bi, dest, msg); }
|
||||
void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override { ratbox->SendGlobopsInternal(source, buf); }
|
||||
void SendSGLine(User *u, const XLine *x) anope_override { ratbox->SendSGLine(u, x); }
|
||||
void SendSGLineDel(const XLine *x) anope_override { ratbox->SendSGLineDel(x); }
|
||||
void SendAkill(User *u, XLine *x) anope_override { ratbox->SendAkill(u, x); }
|
||||
void SendAkillDel(const XLine *x) anope_override { ratbox->SendAkillDel(x); }
|
||||
void SendSQLineDel(const XLine *x) anope_override { ratbox->SendSQLineDel(x); }
|
||||
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { ratbox->SendJoin(user, c, status); }
|
||||
void SendServer(const Server *server) anope_override { ratbox->SendServer(server); }
|
||||
void SendChannel(Channel *c) anope_override { ratbox->SendChannel(c); }
|
||||
void SendTopic(const MessageSource &source, Channel *c) anope_override { ratbox->SendTopic(source, c); }
|
||||
bool IsIdentValid(const Anope::string &ident) anope_override { return ratbox->IsIdentValid(ident); }
|
||||
void SendLogin(User *u, NickAlias *na) anope_override { ratbox->SendLogin(u, na); }
|
||||
void SendLogout(User *u) anope_override { ratbox->SendLogout(u); }
|
||||
|
||||
void SendSQLine(User *, const XLine *x) anope_override
|
||||
{
|
||||
UplinkSocket::Message(Me) << "RESV * " << x->mask << " :" << x->GetReason();
|
||||
}
|
||||
|
||||
void SendConnect() anope_override
|
||||
{
|
||||
UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID();
|
||||
/*
|
||||
* Received: CAPAB :BAN CHW CLUSTER ENCAP EOPMOD EUID EX IE KLN
|
||||
* KNOCK MLOCK QS RSFNC SAVE SERVICES TB UNKLN
|
||||
*
|
||||
* BAN - Can do BAN message
|
||||
* CHW - Can do channel wall @#
|
||||
* CLUSTER - Supports umode +l, can send LOCOPS (encap only)
|
||||
* ENCAP - Can do ENCAP message
|
||||
* EOPMOD - Can do channel wall =# (for cmode +z)
|
||||
* EUID - Can do EUID (its similar to UID but includes the ENCAP REALHOST and ENCAP LOGIN information)
|
||||
* EX - Can do channel +e exemptions
|
||||
* GLN - Can set G:Lines
|
||||
* IE - Can do invite exceptions
|
||||
* KLN - Can set K:Lines (encap only)
|
||||
* KNOCK - Supports KNOCK
|
||||
* MLOCK - Supports MLOCK
|
||||
* RSFNC - Forces a nickname change and propagates it (encap only)
|
||||
* SERVICES - Support channel mode +r (only registered users may join)
|
||||
* SAVE - Resolve a nick collision by changing a nickname to the UID.
|
||||
* TB - Supports topic burst
|
||||
* UNKLN - Can do UNKLINE (encap only)
|
||||
* QS - Can handle quit storm removal
|
||||
*/
|
||||
UplinkSocket::Message() << "CAPAB :BAN CHW CLUSTER ENCAP EOPMOD EUID EX IE KLN KNOCK MLOCK QS RSFNC SERVICES TB UNKLN";
|
||||
|
||||
/* Make myself known to myself in the serverlist */
|
||||
SendServer(Me);
|
||||
|
||||
/*
|
||||
* Received: SVINFO 6 6 0 :1353235537
|
||||
* arg[0] = current TS version
|
||||
* arg[1] = minimum required TS version
|
||||
* arg[2] = '0'
|
||||
* arg[3] = server's idea of UTC time
|
||||
*/
|
||||
UplinkSocket::Message() << "SVINFO 6 6 0 :" << Anope::CurTime;
|
||||
}
|
||||
|
||||
void SendClientIntroduction(User *u) anope_override
|
||||
{
|
||||
Anope::string modes = "+" + u->GetModes();
|
||||
UplinkSocket::Message(Me) << "EUID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " * * :" << u->realname;
|
||||
}
|
||||
|
||||
void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) anope_override
|
||||
{
|
||||
UplinkSocket::Message(Me) << "ENCAP " << u->server->GetName() << " RSFNC " << u->GetUID()
|
||||
<< " " << newnick << " " << when << " " << u->timestamp;
|
||||
}
|
||||
|
||||
void SendSVSHold(const Anope::string &nick, time_t delay) anope_override
|
||||
{
|
||||
UplinkSocket::Message(Me) << "ENCAP * NICKDELAY " << delay << " " << nick;
|
||||
}
|
||||
|
||||
void SendSVSHoldDel(const Anope::string &nick) anope_override
|
||||
{
|
||||
UplinkSocket::Message(Me) << "ENCAP * NICKDELAY 0 " << nick;
|
||||
}
|
||||
|
||||
void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) anope_override
|
||||
{
|
||||
UplinkSocket::Message(Me) << "ENCAP * CHGHOST " << u->GetUID() << " :" << host;
|
||||
}
|
||||
|
||||
void SendVhostDel(User *u) anope_override
|
||||
{
|
||||
this->SendVhost(u, "", u->host);
|
||||
}
|
||||
|
||||
void SendSASLMessage(const SASL::Message &message) anope_override
|
||||
{
|
||||
Server *s = Server::Find(message.target.substr(0, 3));
|
||||
UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : message.target.substr(0, 3)) << " SASL " << message.source << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : (" " + message.ext));
|
||||
}
|
||||
|
||||
void SendSVSLogin(const Anope::string &uid, const Anope::string &acc) anope_override
|
||||
{
|
||||
Server *s = Server::Find(uid.substr(0, 3));
|
||||
UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : uid.substr(0, 3)) << " SVSLOGIN " << uid << " * * * " << acc;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct IRCDMessageEncap : IRCDMessage
|
||||
{
|
||||
IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT);}
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.GetUser();
|
||||
|
||||
// In a burst, states that the source user is logged in as the account.
|
||||
if (params[1] == "LOGIN" || params[1] == "SU")
|
||||
{
|
||||
NickCore *nc = NickCore::Find(params[2]);
|
||||
if (!nc)
|
||||
return;
|
||||
u->Login(nc);
|
||||
}
|
||||
// Received: :42XAAAAAE ENCAP * CERTFP :3f122a9cc7811dbad3566bf2cec3009007c0868f
|
||||
if (params[1] == "CERTFP")
|
||||
{
|
||||
u->fingerprint = params[2];
|
||||
FOREACH_MOD(OnFingerprint, (u));
|
||||
}
|
||||
/*
|
||||
* Received: :42X ENCAP * SASL 42XAAAAAH * S PLAIN
|
||||
* Received: :42X ENCAP * SASL 42XAAAAAC * D A
|
||||
*
|
||||
* Part of a SASL authentication exchange. The mode is 'C' to send some data
|
||||
* (base64 encoded), or 'S' to end the exchange (data indicates type of
|
||||
* termination: 'A' for abort, 'F' for authentication failure, 'S' for
|
||||
* authentication success).
|
||||
*
|
||||
* Charybdis only accepts messages from SASL agents; these must have umode +S
|
||||
*/
|
||||
if (params[1] == "SASL" && SASL::sasl && params.size() >= 6)
|
||||
{
|
||||
SASL::Message m;
|
||||
m.source = params[2];
|
||||
m.target = params[3];
|
||||
m.type = params[4];
|
||||
m.data = params[5];
|
||||
m.ext = params.size() > 6 ? params[6] : "";
|
||||
|
||||
SASL::sasl->ProcessMessage(m);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct IRCDMessageEUID : IRCDMessage
|
||||
{
|
||||
IRCDMessageEUID(Module *creator) : IRCDMessage(creator, "EUID", 11) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
/*
|
||||
* :42X EUID DukePyrolator 1 1353240577 +Zi ~jens erft-5d80b00b.pool.mediaWays.net 93.128.176.11 42XAAAAAD * * :jens
|
||||
* :<SID> EUID <NICK> <HOPS> <TS> +<UMODE> <USERNAME> <VHOST> <IP> <UID> <REALHOST> <ACCOUNT> :<GECOS>
|
||||
* 0 1 2 3 4 5 6 7 8 9 10
|
||||
*
|
||||
* Introduces a user. The hostname field is now always the visible host.
|
||||
* The realhost field is * if the real host is equal to the visible host.
|
||||
* The account field is * if the login is not set.
|
||||
* Note that even if both new fields are *, an EUID command still carries more
|
||||
* information than a UID command (namely that real host is visible host and the
|
||||
* user is not logged in with services). Hence a NICK or UID command received
|
||||
* from a remote server should not be sent in EUID form to other servers.
|
||||
*/
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
NickAlias *na = NULL;
|
||||
if (params[9] != "*")
|
||||
na = NickAlias::Find(params[9]);
|
||||
|
||||
User::OnIntroduce(params[0], params[4], params[8], params[5], params[6], source.GetServer(), params[10], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime, params[3], params[7], na ? *na->nc : NULL);
|
||||
}
|
||||
};
|
||||
|
||||
// we cant use this function from ratbox because we set a local variable here
|
||||
struct IRCDMessageServer : IRCDMessage
|
||||
{
|
||||
IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
// SERVER dev.anope.de 1 :charybdis test server
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
// Servers other then our immediate uplink are introduced via SID
|
||||
if (params[1] != "1")
|
||||
return;
|
||||
new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID);
|
||||
IRCD->SendPing(Me->GetName(), params[0]);
|
||||
}
|
||||
};
|
||||
|
||||
// we cant use this function from ratbox because we set a local variable here
|
||||
struct IRCDMessagePass : IRCDMessage
|
||||
{
|
||||
IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
// UplinkSID is used in IRCDMessageServer
|
||||
UplinkSID = params[3];
|
||||
}
|
||||
};
|
||||
|
||||
class ProtoElemental : public Module
|
||||
{
|
||||
Module *m_ratbox;
|
||||
|
||||
ElementalProto ircd_proto;
|
||||
|
||||
/* Core message handlers */
|
||||
Message::Away message_away;
|
||||
Message::Capab message_capab;
|
||||
Message::Error message_error;
|
||||
Message::Invite message_invite;
|
||||
Message::Kick message_kick;
|
||||
Message::Kill message_kill;
|
||||
Message::Mode message_mode;
|
||||
Message::MOTD message_motd;
|
||||
Message::Notice message_notice;
|
||||
Message::Part message_part;
|
||||
Message::Ping message_ping;
|
||||
Message::Privmsg message_privmsg;
|
||||
Message::Quit message_quit;
|
||||
Message::SQuit message_squit;
|
||||
Message::Stats message_stats;
|
||||
Message::Time message_time;
|
||||
Message::Topic message_topic;
|
||||
Message::Version message_version;
|
||||
Message::Whois message_whois;
|
||||
|
||||
/* Ratbox Message Handlers */
|
||||
ServiceAlias message_bmask, message_join, message_nick, message_pong, message_sid, message_sjoin,
|
||||
message_tb, message_tmode, message_uid;
|
||||
|
||||
/* Our message handlers */
|
||||
IRCDMessageEncap message_encap;
|
||||
IRCDMessageEUID message_euid;
|
||||
IRCDMessagePass message_pass;
|
||||
IRCDMessageServer message_server;
|
||||
|
||||
bool use_server_side_mlock;
|
||||
|
||||
void AddModes()
|
||||
{
|
||||
|
||||
ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1));
|
||||
ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '!', 3));
|
||||
ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'y', '~', 4));
|
||||
|
||||
/* Add user modes */
|
||||
ModeManager::AddUserMode(new UserMode("NOFORWARD", 'Q'));
|
||||
ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
|
||||
ModeManager::AddUserMode(new UserModeOperOnly("OPERWALLS", 'z'));
|
||||
ModeManager::AddUserMode(new UserModeNoone("SSL", 'Z'));
|
||||
|
||||
/* b/e/I */
|
||||
ModeManager::AddChannelMode(new ChannelModeList("QUIET", 'q'));
|
||||
|
||||
/* Add channel modes */
|
||||
ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));
|
||||
ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C'));
|
||||
ModeManager::AddChannelMode(new ChannelModeParam("REDIRECT", 'f'));
|
||||
ModeManager::AddChannelMode(new ChannelMode("ALLOWFORWARD", 'F'));
|
||||
ModeManager::AddChannelMode(new ChannelMode("ALLINVITE", 'g'));
|
||||
ModeManager::AddChannelMode(new ChannelModeParam("JOINFLOOD", 'j'));
|
||||
ModeManager::AddChannelMode(new ChannelModeLargeBan("LBAN", 'L'));
|
||||
ModeManager::AddChannelMode(new ChannelMode("PERM", 'P'));
|
||||
ModeManager::AddChannelMode(new ChannelMode("NOFORWARD", 'Q'));
|
||||
ModeManager::AddChannelMode(new ChannelMode("OPMODERATED", 'z'));
|
||||
}
|
||||
|
||||
public:
|
||||
ProtoElemental(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
|
||||
ircd_proto(this),
|
||||
message_away(this), message_capab(this), message_error(this), message_invite(this), message_kick(this),
|
||||
message_kill(this), message_mode(this), message_motd(this), message_notice(this), message_part(this),
|
||||
message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this),
|
||||
message_time(this), message_topic(this), message_version(this), message_whois(this),
|
||||
|
||||
message_bmask("IRCDMessage", "charybdis/bmask", "ratbox/bmask"),
|
||||
message_join("IRCDMessage", "charybdis/join", "ratbox/join"),
|
||||
message_nick("IRCDMessage", "charybdis/nick", "ratbox/nick"),
|
||||
message_pong("IRCDMessage", "charybdis/pong", "ratbox/pong"),
|
||||
message_sid("IRCDMessage", "charybdis/sid", "ratbox/sid"),
|
||||
message_sjoin("IRCDMessage", "charybdis/sjoin", "ratbox/sjoin"),
|
||||
message_tb("IRCDMessage", "charybdis/tb", "ratbox/tb"),
|
||||
message_tmode("IRCDMessage", "charybdis/tmode", "ratbox/tmode"),
|
||||
message_uid("IRCDMessage", "charybdis/uid", "ratbox/uid"),
|
||||
|
||||
message_encap(this), message_euid(this), message_pass(this), message_server(this)
|
||||
|
||||
{
|
||||
|
||||
|
||||
if (ModuleManager::LoadModule("ratbox", User::Find(creator)) != MOD_ERR_OK)
|
||||
throw ModuleException("Unable to load ratbox");
|
||||
m_ratbox = ModuleManager::FindModule("ratbox");
|
||||
if (!m_ratbox)
|
||||
throw ModuleException("Unable to find ratbox");
|
||||
if (!ratbox)
|
||||
throw ModuleException("No protocol interface for ratbox");
|
||||
|
||||
this->AddModes();
|
||||
}
|
||||
|
||||
~ProtoElemental()
|
||||
{
|
||||
m_ratbox = ModuleManager::FindModule("ratbox");
|
||||
ModuleManager::UnloadModule(m_ratbox, NULL);
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) anope_override
|
||||
{
|
||||
use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock");
|
||||
}
|
||||
|
||||
void OnChannelSync(Channel *c) anope_override
|
||||
{
|
||||
if (!c->ci)
|
||||
return;
|
||||
|
||||
ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks");
|
||||
if (use_server_side_mlock && modelocks && Servers::Capab.count("MLOCK") > 0)
|
||||
{
|
||||
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "");
|
||||
UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->name << " " << modes;
|
||||
}
|
||||
}
|
||||
|
||||
EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override
|
||||
{
|
||||
ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks");
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name);
|
||||
if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
|
||||
{
|
||||
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar;
|
||||
UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes;
|
||||
}
|
||||
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
|
||||
EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override
|
||||
{
|
||||
ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks");
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name);
|
||||
if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
|
||||
{
|
||||
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, "");
|
||||
UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes;
|
||||
}
|
||||
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
};
|
||||
|
||||
MODULE_INIT(ProtoElemental)
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2004 E. Will et al.
|
||||
* Copyright (c) 2005-2008 Atheme Development Group
|
||||
* Copyright (c) 2008-2010 ShadowIRCd Development Group
|
||||
* Copyright (c) 2013 PonyChat Development Group
|
||||
* Rights to this code are documented in doc/LICENSE.
|
||||
*
|
||||
* This file contains protocol support for ponychat-ircd.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "atheme.h"
|
||||
#include "uplink.h"
|
||||
#include "pmodule.h"
|
||||
#include "protocol/shadowircd.h"
|
||||
|
||||
DECLARE_MODULE_V1("protocol/elemental-ircd", true, _modinit, NULL, PACKAGE_STRING, "PonyChat Development Group <http://www.ponychat.net>");
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
ircd_t elemental_ircd = {
|
||||
"elemental-ircd", /* IRCd name */
|
||||
"$$", /* TLD Prefix, used by Global. */
|
||||
true, /* Whether or not we use IRCNet/TS6 UID */
|
||||
false, /* Whether or not we use RCOMMAND */
|
||||
true, /* Whether or not we support channel owners. */
|
||||
true, /* Whether or not we support channel protection. */
|
||||
true, /* Whether or not we support halfops. */
|
||||
false, /* Whether or not we use P10 */
|
||||
false, /* Whether or not we use vHosts. */
|
||||
CMODE_EXLIMIT | CMODE_PERM | CMODE_IMMUNE, /* Oper-only cmodes */
|
||||
CSTATUS_OWNER, /* Integer flag for owner channel flag. */
|
||||
CSTATUS_PROTECT, /* Integer flag for protect channel flag. */
|
||||
CSTATUS_HALFOP, /* Integer flag for halfops. */
|
||||
"+y", /* Mode we set for owner. */
|
||||
"+a", /* Mode we set for protect. */
|
||||
"+h", /* Mode we set for halfops. */
|
||||
PROTOCOL_SHADOWIRCD, /* Protocol type */
|
||||
CMODE_PERM, /* Permanent cmodes */
|
||||
CMODE_IMMUNE, /* Oper-immune cmode */
|
||||
"beIq", /* Ban-like cmodes */
|
||||
'e', /* Except mchar */
|
||||
'I', /* Invex mchar */
|
||||
IRCD_CIDR_BANS | IRCD_HOLDNICK /* Flags */
|
||||
};
|
||||
|
||||
struct cmode_ elemental_mode_list[] = {
|
||||
{ 'i', CMODE_INVITE },
|
||||
{ 'm', CMODE_MOD },
|
||||
{ 'n', CMODE_NOEXT },
|
||||
{ 'p', CMODE_PRIV },
|
||||
{ 's', CMODE_SEC },
|
||||
{ 't', CMODE_TOPIC },
|
||||
{ 'c', CMODE_NOCOLOR},
|
||||
{ 'r', CMODE_REGONLY},
|
||||
{ 'z', CMODE_OPMOD },
|
||||
{ 'g', CMODE_FINVITE},
|
||||
{ 'L', CMODE_EXLIMIT},
|
||||
{ 'P', CMODE_PERM },
|
||||
{ 'F', CMODE_FTARGET},
|
||||
{ 'Q', CMODE_DISFWD },
|
||||
{ 'M', CMODE_IMMUNE },
|
||||
{ 'C', CMODE_NOCTCP },
|
||||
{ 'A', CMODE_ADMINONLY },
|
||||
{ 'O', CMODE_OPERONLY },
|
||||
{ 'S', CMODE_SSLONLY },
|
||||
{ 'D', CMODE_NOACTIONS },
|
||||
{ 'T', CMODE_NONOTICE },
|
||||
{ 'G', CMODE_NOCAPS },
|
||||
{ 'E', CMODE_NOKICKS },
|
||||
{ 'd', CMODE_NONICKS },
|
||||
{ 'K', CMODE_NOREPEAT },
|
||||
{ 'J', CMODE_KICKNOREJOIN },
|
||||
{ '\0', 0 }
|
||||
};
|
||||
|
||||
struct cmode_ elemental_status_mode_list[] = {
|
||||
{ 'y', CSTATUS_OWNER },
|
||||
{ 'a', CSTATUS_PROTECT },
|
||||
{ 'o', CSTATUS_OP },
|
||||
{ 'h', CSTATUS_HALFOP },
|
||||
{ 'v', CSTATUS_VOICE },
|
||||
{ '\0', 0 }
|
||||
};
|
||||
|
||||
struct cmode_ elemental_prefix_mode_list[] = {
|
||||
{ '~', CSTATUS_OWNER },
|
||||
{ '!', CSTATUS_PROTECT },
|
||||
{ '@', CSTATUS_OP },
|
||||
{ '%', CSTATUS_HALFOP },
|
||||
{ '+', CSTATUS_VOICE },
|
||||
{ '\0', 0 }
|
||||
};
|
||||
|
||||
struct cmode_ elemental_user_mode_list[] = {
|
||||
{ 'a', UF_ADMIN },
|
||||
{ 'i', UF_INVIS },
|
||||
{ 'o', UF_IRCOP },
|
||||
{ 'D', UF_DEAF },
|
||||
{ '\0', 0 }
|
||||
};
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
void _modinit(module_t * m)
|
||||
{
|
||||
MODULE_TRY_REQUEST_DEPENDENCY(m, "protocol/charybdis");
|
||||
|
||||
mode_list = elemental_mode_list;
|
||||
user_mode_list = elemental_user_mode_list;
|
||||
status_mode_list = elemental_status_mode_list;
|
||||
prefix_mode_list = elemental_prefix_mode_list;
|
||||
|
||||
ircd = &elemental_ircd;
|
||||
|
||||
m->mflags = MODTYPE_CORE;
|
||||
|
||||
pmodule_loaded = true;
|
||||
}
|
||||
|
||||
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
|
||||
* vim:ts=8
|
||||
* vim:sw=8
|
||||
* vim:noexpandtab
|
||||
*/
|
|
@ -1,6 +1,6 @@
|
|||
CHANTRACE <#channel>
|
||||
|
||||
Outputs a list of members in #channel in ETRACE format, with the classname
|
||||
Outputs a list of members in #channel in ETRACE format, with the class name
|
||||
replaced by the server the users are on.
|
||||
|
||||
You must be a member of the channel to perform this command.
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
MODE <channel> <+|-><modes> [parameters]
|
||||
|
||||
Channelmodes: (* designates that the cmode can only be set by opers)
|
||||
(? designates that the cmode is provided by an extension
|
||||
and may not be present on this server)
|
||||
Channel modes: (* designates that the cmode can only be set by opers)
|
||||
(? designates that the cmode is provided by an extension
|
||||
and may not be present on all servers)
|
||||
(^ designates that the cmode may be disabled in the
|
||||
configuration and may not be present on this network)
|
||||
|
||||
CHANNELMODE - DESCRIPTION
|
||||
------------------------------------------------------------------------
|
||||
|
@ -13,17 +15,19 @@ NO PARAMETERS:
|
|||
+s - Secret. Channel will not be shown in /whois and /list etc.
|
||||
+p - Private. Disables /knock to the channel.
|
||||
+m - Moderated. Only opped/voiced users may talk in channel.
|
||||
+i - Invite only. Users need to be /invite'd or match a +I to
|
||||
+i - Invite only. Users need to be invited or match a +I to
|
||||
join the channel.
|
||||
+r - Registered users only. Only users identified to services
|
||||
may join.
|
||||
+c - No color. All color codes in messages are stripped.
|
||||
+d - No nickchanges. People on the channel will not be able to
|
||||
+d - No nick changes. People on the channel will not be able to
|
||||
change nick.
|
||||
+g - Free invite. Everyone may invite users. Significantly
|
||||
weakens +i control.
|
||||
+z - Op moderated. Messages blocked by +m, +b and +q are instead
|
||||
sent to ops.
|
||||
+u - Hidden ban/quiet list. Ban/quiet lists may only be seen
|
||||
by halfops or higher.
|
||||
* +L - Large ban list. Increase maximum number of +beIq entries.
|
||||
* +P - Permanent. Channel does not disappear when empty.
|
||||
+F - Free target. Anyone may set forwards to this (otherwise
|
||||
|
@ -38,15 +42,18 @@ NO PARAMETERS:
|
|||
+E - No kicks. Chanops will not be able to use /kick on this
|
||||
channel.
|
||||
+G - Block messages in all caps. Messages that are more than
|
||||
50% capital letters will be blocked.
|
||||
+J - Prevent autorejoin on kick. Users will not be able to
|
||||
rejoin immediately after being kicked.
|
||||
50% capital letters will be blocked. Messages shorter than
|
||||
10 characters are ignored.
|
||||
+J - Prevent automatic rejoin on kick. Users will not be able to
|
||||
rejoin immediately after being kicked.
|
||||
+K - No repeat messages. Messages that are the same as the
|
||||
last message sent to the channel will be blocked.
|
||||
* +M - Immune. Opers cannot be kicked from the channel. May
|
||||
be set by admins regardless of channel status. Users
|
||||
will not see this mode at all. Can only be set by admins.
|
||||
Opers may still be kicked from the channel by services.
|
||||
be set by server admins regardless of channel status.
|
||||
Users will not see this mode at all. May only be set by
|
||||
server admins.
|
||||
Opers may still be kicked from the channel by services or
|
||||
any other u-lined server.
|
||||
?* +O - Oper only channel. Only opers will be able to join.
|
||||
?* +A - Admin only channel. Only admins will be able to join.
|
||||
Can only be set by admins.
|
||||
|
@ -64,12 +71,14 @@ WITH PARAMETERS:
|
|||
PARAMS: /mode #channel +l limit
|
||||
+v - Voice. Allows a user to talk in a +m channel. Noted by +nick.
|
||||
PARAMS: /mode #channel +v nick
|
||||
+h - Halfop. Grants channel half-operator status.
|
||||
^ +h - Halfop. Grants channel half-operator status.
|
||||
PARAMS: /mode #channel +h nick
|
||||
+o - Op. Grants channel operator status.
|
||||
PARAMS: /mode #channel +o nick
|
||||
+a - Admin. Grants channel administrator status.
|
||||
^ +a - Admin. Grants channel administrator status.
|
||||
PARAMS: /mode #channel +a nick
|
||||
^ +y - Owner. Grants channel owner status.
|
||||
PARAMS: /mode #channel +y nick
|
||||
+b - Ban. Prevents a user from entering the channel, and from
|
||||
sending or changing nick if they are on it, based on a
|
||||
nick!ident@host match.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
CNOTICE <nick> <channel> :<text>
|
||||
|
||||
Providing you are opped (+o) or voiced (+v) in <channel>, and <nick>
|
||||
is a member of <channel>, CNOTICE generates a NOTICE towards
|
||||
<nick>. CNOTICE bypasses any anti-spam measures in place.
|
||||
Providing you are a channel owner (+y), a channel admin (+a),
|
||||
a channel operator (+o), a half-operator (+h) or voiced (+v) in
|
||||
<channel>, and <nick> is a member of <channel>, CNOTICE
|
||||
generates a NOTICE towards <nick> that bypasses any anti-spam
|
||||
measures in place.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CONNECT <server_A> [port] [server_B]
|
||||
|
||||
When [server_B] is used, CONNECT asks [server_B] to
|
||||
connect to <server_A>. Requires Oper Priv: R
|
||||
connect to <server_A>. Requires Oper Priv: oper:routing
|
||||
|
||||
The [port] must be specified with [server_B], this is
|
||||
usually 6667. To use the default port in the connect
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
CPRIVMSG <nick> <channel> :<text>
|
||||
|
||||
Providing you are opped (+o) or voiced (+v) in <channel>, and <nick>
|
||||
is a member of <channel>, CPRIVMSG generates a PRIVMSG towards
|
||||
<nick>. CPRIVMSG bypasses any anti-spam measures in place.
|
||||
Providing you are a channel owner (+y), a channel admin (+a),
|
||||
a channel operator (+o), a half-operator (+h) or voiced (+v) in
|
||||
<channel>, and <nick> is a member of <channel>, CPRIVMSG
|
||||
generates a PRIVMSG towards <nick> that bypasses any anti-spam
|
||||
measures in place
|
||||
|
|
|
@ -5,6 +5,7 @@ Help files were written by the following people:
|
|||
disasta David Daley <disasta@go.com>
|
||||
Hwy101 W. Campbell <wcampbel@botbay.net>
|
||||
larne Edward Brocklesby <ejb@leguin.org.uk>
|
||||
lyska Sam Dodrill <shadowh511@gmail.com>
|
||||
MoeBass anonymous <moe@moebass.com>
|
||||
screwedup Jonathan Roes <jroes@magenet.net>
|
||||
zartik Daniel Hemmerich <dan@spot.org>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
DIE server.name [server.name]
|
||||
|
||||
Terminatess the IRC server. If a second server name
|
||||
Terminates the IRC server. If a second server name
|
||||
is provided, remotely terminate that server. In this
|
||||
case, both server names must match.
|
||||
|
||||
- Requires Oper Priv: D
|
||||
- Requires Oper Priv: oper:die
|
||||
|
|
|
@ -3,7 +3,7 @@ DLINE [duration] <ip> :[reason] [| oper reason]
|
|||
Adds a DLINE to the database which will deny any
|
||||
connections from the IP address of the banned client.
|
||||
The banned client will receive a message saying
|
||||
he/she is banned with reason [reason].
|
||||
they are banned with reason [reason].
|
||||
|
||||
Duration is optional, and is in minutes. If specified,
|
||||
the DLINE will not be saved in the database.
|
||||
|
@ -17,4 +17,4 @@ DLINE [duration] <ip> ON irc.server :[reason] [| oper reason]
|
|||
will dline the user on irc.server if irc.server accepts
|
||||
remote dlines. irc.server can contain wildcards.
|
||||
|
||||
- Requires Oper Priv: K
|
||||
- Requires Oper Priv: oper:kline
|
||||
|
|
|
@ -3,5 +3,5 @@ KILL <nick> <reason>
|
|||
Disconnects user <nick> from the IRC server he/she
|
||||
is connected to with reason <reason>.
|
||||
|
||||
- Requires Oper Priv: C
|
||||
- Requires Oper Priv: O for users not on your IRC server
|
||||
- Requires Oper Priv: oper:local_kill
|
||||
- Requires Oper Priv: oper:global_kill for users not on your IRC server
|
||||
|
|
|
@ -23,4 +23,4 @@ KLINE [duration] <user@host> ON irc.server :[reason] [| oper reason]
|
|||
will kline the user on irc.server if irc.server accepts
|
||||
remote klines. irc.server can contain wildcards.
|
||||
|
||||
- Requires Oper Priv: K
|
||||
- Requires Oper Priv: oper:kline
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
LOCOPS :<message>
|
||||
|
||||
Sends an LOCOPS message of <message> to all
|
||||
Sends a LOCOPS message of <message> to all
|
||||
opers on local server who are umode +l
|
||||
|
|
|
@ -11,4 +11,4 @@ shared priv on that server. If you're doing modlist
|
|||
on a remote server, a match string is required, but *
|
||||
will list all modules.
|
||||
|
||||
- Requires Oper Priv: A
|
||||
- Requires Oper Priv: oper:admin
|
||||
|
|
|
@ -6,8 +6,8 @@ from / or from the IRCD_PREFIX
|
|||
(ie modules/autoload/m_users.so)
|
||||
|
||||
A server name may also be provided to load a module
|
||||
on a remote server if you have the modules shared priv
|
||||
on a remote server if you have the modules shared priv
|
||||
on that server. Wildcards for server name may also be
|
||||
used to load a module on multiple servers.
|
||||
|
||||
- Requires Oper Priv: A
|
||||
- Requires Oper Priv: oper:admin
|
||||
|
|
|
@ -4,8 +4,8 @@ MODRELOAD <module.so> [server.name]
|
|||
Use just the module name, the path is not needed.
|
||||
|
||||
A server name may also be provided to reload a module
|
||||
on a remote server if you have the modules shared priv
|
||||
on a remote server if you have the modules shared priv
|
||||
on that server. Wildcards for server name may also be
|
||||
used to reload a module on multiple servers.
|
||||
|
||||
- Requires Oper Priv: A
|
||||
- Requires Oper Priv: oper:admin
|
||||
|
|
|
@ -5,8 +5,8 @@ All modules are unloaded, then those in modules/autoload
|
|||
are loaded
|
||||
|
||||
A server name may also be provided to reload all modules
|
||||
on a remote server if you have the modules shared priv
|
||||
on a remote server if you have the modules shared priv
|
||||
on that server. Wildcards for server name may also be
|
||||
used to reload all modules on multiple servers.
|
||||
|
||||
- Requires Oper Priv: A
|
||||
- Requires Oper Priv: oper:admin
|
||||
|
|
|
@ -10,4 +10,4 @@ from a remote server if you have the modules shared priv
|
|||
on that server. Wildcards for server name may also be used
|
||||
to unload a module from multiple servers.
|
||||
|
||||
- Requires Oper Priv: A
|
||||
- Requires Oper Priv: oper:admin
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
OJOIN [@|+]<#channel>
|
||||
OJOIN [~|!|@|%|+]<#channel>
|
||||
|
||||
-- This commands allows opers to join a channel through bans and many cmodes.
|
||||
This command bypasses bans and cmodes +i, +k, +r, +J, +S, +l to allow
|
||||
opers to join any channel. If the channel name is prefixed with @ or +,
|
||||
you will join that channel and have ops or voice, respectively.
|
||||
-- This commands allows opers to join a channel, breaking through bans and
|
||||
many cmodes. This command bypasses bans and cmodes +i, +k, +r, +J, +S, +l, +j to allow
|
||||
opers to join any channel. If the channel name is prefixed with ~, !, @ % or +,
|
||||
you will join that channel and have channel owner, channel admin,
|
||||
channel operator, half-operator, or voice granted by the server depending on
|
||||
the prefix specified.
|
||||
|
|
|
@ -2,4 +2,4 @@ OKICK <#channel> <nick> [reason]
|
|||
|
||||
-- Allows a oper to kick a user from a channel.
|
||||
This command allows a oper to kick a user from a channel
|
||||
where the oper doesn't have ops.
|
||||
where the oper doesn't have channel access to do so normally.
|
||||
|
|
|
@ -4,3 +4,5 @@ OLIST [#channel]
|
|||
This command allows opers to view all channels in a list, including
|
||||
secret channels. This command also shows channelmodes for each channel
|
||||
unlike LIST.
|
||||
|
||||
This command is deprecated in favor of the OPERSPY in LIST.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue