summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--docs/COPYING40
-rw-r--r--docs/conf/censor.conf.example8
-rw-r--r--docs/conf/filter.conf.example2
-rw-r--r--docs/conf/helpop-full.conf.example2
-rw-r--r--docs/conf/helpop.conf.example2
-rw-r--r--docs/conf/inspircd.conf.example22
-rw-r--r--docs/conf/links.conf.example7
-rw-r--r--docs/conf/modules.conf.example99
-rw-r--r--docs/conf/modules/charybdis.conf.example24
-rw-r--r--docs/conf/modules/unrealircd.conf.example28
-rw-r--r--docs/conf/motd.txt.example2
-rw-r--r--docs/conf/opermotd.txt.example2
-rw-r--r--docs/conf/opers.conf.example14
-rw-r--r--include/base.h2
-rw-r--r--include/socketengine.h8
-rw-r--r--src/commands/cmd_whowas.cpp11
-rw-r--r--src/helperfuncs.cpp21
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/inspsocket.cpp22
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp10
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp2
-rw-r--r--src/modules/m_dnsbl.cpp32
-rw-r--r--src/modules/m_ircv3.cpp2
-rw-r--r--src/modules/m_permchannels.cpp106
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp32
-rw-r--r--src/modules/m_spanningtree/main.cpp7
-rw-r--r--src/modules/m_spanningtree/utils.h3
-rw-r--r--src/modules/m_userip.cpp2
-rw-r--r--src/socketengine.cpp23
-rw-r--r--src/socketengines/socketengine_epoll.cpp4
-rw-r--r--src/socketengines/socketengine_kqueue.cpp4
-rw-r--r--src/socketengines/socketengine_poll.cpp44
-rw-r--r--src/socketengines/socketengine_ports.cpp4
-rw-r--r--src/socketengines/socketengine_select.cpp4
-rw-r--r--src/threadengines/threadengine_pthread.cpp11
-rw-r--r--src/threadengines/threadengine_win32.cpp10
-rw-r--r--win/inspircd_win32wrapper.cpp7
38 files changed, 358 insertions, 271 deletions
diff --git a/README.md b/README.md
index 2f77c5c15..caadad82d 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,6 @@ many different users.
### Links
-* [Website](http://inspircd.github.com)
-* [GitHub]( https://github.com/inspircd)
+* [Website](http://inspircd.org)
+* [GitHub](https://github.com/inspircd)
* [IRC](irc://irc.chatspike.net/inspircd) \ No newline at end of file
diff --git a/docs/COPYING b/docs/COPYING
index 1c8a914d4..6e2ceda85 100644
--- a/docs/COPYING
+++ b/docs/COPYING
@@ -7,14 +7,14 @@
----------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ Version 2, June 1991
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -23,7 +23,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
+the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
@@ -63,8 +63,8 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
-
- GNU GENERAL PUBLIC LICENSE
+
+ GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -118,7 +118,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
-
+
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
@@ -176,7 +176,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
-
+
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
@@ -233,7 +233,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
-
+
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
@@ -263,7 +263,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -285,9 +285,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Programs
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -299,7 +299,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
+ Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -311,16 +311,16 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
- Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
@@ -343,5 +343,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
+library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
diff --git a/docs/conf/censor.conf.example b/docs/conf/censor.conf.example
index 342ccd875..ea9e08147 100644
--- a/docs/conf/censor.conf.example
+++ b/docs/conf/censor.conf.example
@@ -1,11 +1,9 @@
-# Configuration file for m_censor.so (1.0.0.0)
-# C.J.Edwards May 2004.
-#
+# Configuration file for m_censor.so
# The tags for this module are formatted as follows:
#
-# <badword text="simple word"
-# replace="text to replace with">
+# <badword text="simple word"
+# replace="text to replace with">
#
# You can specify <badword text="simple word" replace="">
# to block lines containing the word
diff --git a/docs/conf/filter.conf.example b/docs/conf/filter.conf.example
index 922f55fb6..8f5d20c24 100644
--- a/docs/conf/filter.conf.example
+++ b/docs/conf/filter.conf.example
@@ -1,4 +1,4 @@
-# Configuration file for m_filter.so and m_filter_pcre.so
+# Configuration file for m_filter.so
# The tags for this module are formatted as follows:
#
diff --git a/docs/conf/helpop-full.conf.example b/docs/conf/helpop-full.conf.example
index 0cabfccd0..bddb5846a 100644
--- a/docs/conf/helpop-full.conf.example
+++ b/docs/conf/helpop-full.conf.example
@@ -769,7 +769,7 @@ Closes all unregistered connections to the local server.">
c Blocks private messages and notices from users who do
not share a common channel with you (requires
commonchans module).
- d Deaf mode. User will not recieve any messages or notices
+ d Deaf mode. User will not receive any messages or notices
from channels they are in (requires deaf module).
g In combination with /allow, provides for server side
ignore (requires callerid module).
diff --git a/docs/conf/helpop.conf.example b/docs/conf/helpop.conf.example
index b4c1e7d67..2c5102fcc 100644
--- a/docs/conf/helpop.conf.example
+++ b/docs/conf/helpop.conf.example
@@ -77,7 +77,7 @@ LOCKSERV UNLOCKSERV JUMPSERVER">
c Blocks private messages and notices from users who do
not share a common channel with you (requires
commonchans module).
- d Deaf mode. User will not recieve any messages or notices
+ d Deaf mode. User will not receive any messages or notices
from channels they are in (requires deaf module).
g In combination with /allow, provides for server side
ignore (requires callerid module).
diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example
index 036a3ebfc..8a498577a 100644
--- a/docs/conf/inspircd.conf.example
+++ b/docs/conf/inspircd.conf.example
@@ -136,12 +136,9 @@
# |_| \_\___|\__,_|\__,_| |_| |_| |_|_|___/ |____/|_|\__(_) #
# #
# If you want to link servers to InspIRCd you must load the #
-# m_spanningtree.so module! Please see the modules list below for #
+# m_spanningtree.so module! Please see the modules list for #
# information on how to load this module! If you do not load this #
-# module, server ports will NOT be bound! #
-# #
-# PLEASE NOTE: If you have build InspIRCd with IPv6 support, you MUST #
-# specify a bind address if you want the IRCd to bind to a IPv4 IP. #
+# module, server ports will NOT work! #
<bind
# address: IP address to bind to if the box that you are hosting
@@ -198,10 +195,12 @@
# #
<power
- # hash: what hash these passwords are hashed with. requires the module
- # for selected hash (m_md5.so, m_sha256.so or m_ripemd160.so) be
- # loaded and the password hashing module (m_password_hash.so)
- # loaded. Options here are: "md5", "sha256" and "ripemd160".
+ # hash: what hash these passwords are hashed with.
+ # Requires the module for selected hash (m_md5.so, m_sha256.so
+ # or m_ripemd160.so) be loaded and the password hashing module
+ # (m_password_hash.so) loaded.
+ # Options here are: "md5", "sha256" and "ripemd160", or one of
+ # these prefixed with "hmac-", e.g.: "hmac-sha256".
# Optional, but recommended. Create hashed password with:
# /mkpasswd <hash> <password>
#hash="sha256"
@@ -639,13 +638,10 @@
# #
<performance
- # netbuffersize: Size of the buffer used to recieve data from clients.
+ # netbuffersize: Size of the buffer used to receive data from clients.
# The ircd may only read this amount of text in 1 go at any time.
netbuffersize="10240"
- # maxwho: Maximum number of results to show in a /who query.
- maxwho="4096"
-
# somaxconn: The maximum number of connections that may be waiting
# in the accept queue. This is *NOT* the total maximum number of
# connections per server. Some systems may only allow this to be up
diff --git a/docs/conf/links.conf.example b/docs/conf/links.conf.example
index 76e9c09cb..382455bcd 100644
--- a/docs/conf/links.conf.example
+++ b/docs/conf/links.conf.example
@@ -36,10 +36,9 @@
# failover (see above).
timeout="300"
- # ssl: If defined, this states extra modules that will be used when
+ # ssl: If defined, this states the SSL module that will be used when
# making an outbound connection to the server. Options are: "openssl"
- # and "gnutls" for encryption (they are compatible with each other).
- # You must use the same (or a compatible) transport on both sides of the link.
+ # and "gnutls" (they are compatible with each other).
#
# You will need to load the m_ssl_openssl.so module for openssl,
# m_ssl_gnutls.so for gnutls. The server port that you connect to
@@ -100,7 +99,7 @@
# Failover autoconnect block. If you have multiple hubs, or want your network
# to automatically link even if the hub is down, you can specify multiple
-# space seperated servers to autoconnect; they will be tried in a round
+# space separated servers to autoconnect; they will be tried in a round
# robin fashion until one succeeds. Period defines the time for restarting
# a single loop.
<autoconnect period="120"
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example
index ca1340f04..d329ab522 100644
--- a/docs/conf/modules.conf.example
+++ b/docs/conf/modules.conf.example
@@ -210,7 +210,7 @@
# Allow opers (channels/auspex) to see see all joins/parts/kicks in the channel
#
# Exemptchanops can be used to adjust the level at which users become visible or
-# the level at which they can see the full membe list of the channel.
+# the level at which they can see the full member list of the channel.
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Autoop module: Adds basic channel access controls via the +w listmode.
@@ -265,7 +265,7 @@
# capsmap="ABCDEFGHIJKLMNOPQRSTUVWXYZ! ">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# Block color module: Blocking color-coded messages with cmode +c
+# Block color module: Blocking color-coded messages with chan mode +c
#<module name="m_blockcolor.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
@@ -274,7 +274,7 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# CallerID module: Adds usermode +g which activates hybrid-style
-# callerid (== block all private messages unless you /accept first)
+# callerid: block all private messages unless you /accept first
#<module name="m_callerid.so">
#
#-#-#-#-#-#-#-#-#-#-#- CALLERID CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
@@ -399,7 +399,7 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Channel Names module: Allows disabling channels which have certain
-# characters in the channel name such as bold, colorcodes, etc which
+# characters in the channel name such as bold, colorcodes, etc. which
# can be quite annoying and allow users to on occasion have a channel
# that looks like the name of another channel on the network.
#<module name="m_channames.so">
@@ -494,8 +494,8 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Clones module: Adds an oper command /CLONES for detecting cloned
-# users. Warning: This module may be resource intensive when its
-# command is issued, use with care.
+# users. Warning: This command may be resource intensive when it is
+# issued, use with care.
# This module is oper-only.
# To use, CLONES must be in one of your oper class blocks.
#<module name="m_clones.so">
@@ -544,7 +544,7 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# Channel cycle module. Server side /hop, with +ilk etc bypass.
+# Channel cycle module. Server side /hop, with +ilk etc. bypass.
#<module name="m_cycle.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
@@ -582,7 +582,7 @@
# quitmsg="Throttled" bootwait="10">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# Custom prefixes: allows for channel prefixes to be added.
+# Custom prefixes: allows for channel prefixes to be added.
#<module name="m_customprefix.so">
#
# name The name of the mode, must be unique from other modes
@@ -596,6 +596,8 @@
#<customprefix name="admin" letter="a" prefix="&amp;" rank="40000" ranktoset="50000">
#<customprefix name="halfop" letter="h" prefix="%" rank="20000" ranktoset="30000">
#<customprefix name="halfvoice" letter="V" prefix="-" rank="1" ranktoset="20000">
+#
+# Do /reloadmodule m_customprefix.so after changing the settings of this module.
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Custom title module: Adds the /TITLE command which allows for trusted
@@ -684,7 +686,7 @@
# Glob masks are accepted here also.
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# Devoice Module: Let users devoice themselves.
+# Devoice Module: Let users devoice themselves using /devoice #chan.
#<module name="m_devoice.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
@@ -787,7 +789,7 @@
#<include file="examples/inspircd.helpop-full.example">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# HIDECHANS module: Allows opers to hide their channels list from non-
+# HIDECHANS module: Allows users to hide their channels list from non-
# opers by setting user mode +I on themselves.
#<module name="m_hidechans.so">
#
@@ -900,7 +902,7 @@
#<module name="m_ircv3.so">
# The following block can be used to control which extensions are
# enabled.
-#<ircv3 accoutnotify="on" awaynotify="on" extendedjoin="on">
+#<ircv3 accountnotify="on" awaynotify="on" extendedjoin="on">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Join flood module: Adds support for join flood protection (+j)
@@ -1034,7 +1036,7 @@
# are specified in a <class> tag that the oper is part of. This is so #
# you can control who has access to this possible dangerous command. #
# If your server is locked and you get disconnected, do a REHASH from #
-# shell to open up again.
+# shell to open up again. #
#
# This module is oper-only.
#
@@ -1043,7 +1045,7 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Map hiding module: replaces /MAP and /LINKS output to users with a #
# message to see a website, set by maphide="http://link.to/site" in #
-# the security tag, instead. #
+# the <security> tag, instead. #
#<module name="m_maphide.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
@@ -1136,10 +1138,10 @@
#<module name="m_nokicks.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# No nicks module: Adds the +N channel mode, as well as the +b N:
-# extended bantype. +N stops all users from changing their nick,
-# the +b N: extban stops anyone from matching a +b N:nick!user@host
-# mask from changing their nick.
+# No nicks module: Adds the +N channel mode, as well as the N extban.
+# +N stops all users from changing their nick, the N extban stops
+# anyone from matching a +b N:nick!user@host mask from changing their
+# nick.
#<module name="m_nonicks.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
@@ -1153,7 +1155,7 @@
#<module name="m_nonotice.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# Network buisness join module
+# Network business join module
# Allows an oper to join a channel using /OJOIN, giving them +Y on the
# channel which makes them immune to kick/deop/etc.
#<module name="m_ojoin.so">
@@ -1185,7 +1187,7 @@
# If you are using the m_operjoin.so module, specify options here: #
# #
# channel - The channel name to join, can also be a comma #
-# seperated list eg. "#channel1,#channel2". #
+# separated list eg. "#channel1,#channel2". #
# #
# override - Lets the oper join walking thru any modes that #
# might be set, even bans. Use "yes" or "no". #
@@ -1217,7 +1219,7 @@
#<operprefix prefix="!">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# Oper MOTD module: Provides support for seperate message of the day
+# Oper MOTD module: Provides support for separate message of the day
# on oper-up
# This module is oper-only.
#<module name="m_opermotd.so">
@@ -1249,7 +1251,7 @@
# Oper levels module: Gives each oper a level and prevents
# actions being taken against higher level opers
# Specify the level as the 'level' parameter of the <type> tag
-# # This module is oper-only.
+# This module is oper-only.
#<module name="m_operlevels.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
@@ -1276,7 +1278,7 @@
# You can also use $user for the user ident string.
forwardmsg="NOTICE $nick :*** Forwarding PASS to $nickrequired"
- # cmd: Command for the nick to run when it recieves a connect
+ # cmd: Command for the nick to run when it receives a connect
# password.
cmd="PRIVMSG $nickrequired :IDENTIFY $pass">
@@ -1317,7 +1319,9 @@
# whenever +P is set, unset, or the topic/modes on a +P channel is changed.
# If you want to do this, set the filename below, and uncomment the include.
#
-#<permchanneldb filename="data/permchannels.conf">
+# If 'listmodes' is true then all list modes (+b, +I, +e, +g...) will be
+# saved. Defaults to false.
+#<permchanneldb filename="data/permchannels.conf" listmodes="true">
#<include file="data/permchannels.conf">
#
# You may also create channels on startup by using the <permchannels> block.
@@ -1356,7 +1360,7 @@
# Optional - If you specify to use the m_randquote.so module, then #
# specify below the path to the randquotes.conf file. #
# #
-#<randquote file="randquotes.conf">
+#<randquote file="quotes.txt">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Redirect module: Adds channel redirection (mode +L) #
@@ -1394,8 +1398,8 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Regular Expression Provider for POSIX Regular Expressions.
# You shouldn't need any additional libraries on a POSIX-compatible
-# system (ie: any Linux, BSD, but not Windows). You must have at least
-# 1 provider loaded to use m_filter or m_rline.
+# system (i.e.: any Linux, BSD, but not Windows). You must have at
+# least 1 provider loaded to use m_filter or m_rline.
# On POSIX-compliant systems, regex syntax can be found by using the
# command: 'man 7 regex'.
#<module name="m_regex_posix.so">
@@ -1591,7 +1595,7 @@
# and is similar in operation to the way asuka and ircu handle services.
#
# At the same time, this offers +r for users and channels to mark them
-# as identified seperately from the idea of a master account, which
+# as identified separately from the idea of a master account, which
# can be useful for services which are heavily nick-as-account centric.
#
# This replaces m_services from 1.1 and earlier.
@@ -1618,8 +1622,6 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# SETNAME module: Adds the /SETNAME command
-# This module is oper-only.
-# To use, SETNAME must be in one of your oper class blocks.
#<module name="m_setname.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
@@ -1639,7 +1641,7 @@
# it directly affects the mode object itself.
#<showwhois opersonly="yes"
#
-# You may also set whether or not users should recieve whois notices, should
+# You may also set whether or not users should receive whois notices, should
# they be /whois'd by an oper.
# showfromopers="yes">
@@ -1665,20 +1667,16 @@
#<module name="m_sslmodes.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# GnuTLS ssl module: Adds support for client-server SSL using GnuTLS,
-# if enabled. You must copy the source for this module from the directory
-# src/modules/extra, or answer 'yes' in ./configure when asked if you
-# want to enable this, or it will not load.
+# GnuTLS SSL module: Adds support for SSL connections using GnuTLS,
+# if enabled. You must answer 'yes' in ./configure when asked or
+# manually symlink the source for this module from the directory
+# src/modules/extra, if you want to enable this, or it will not load.
#<module name="m_ssl_gnutls.so">
#
#-#-#-#-#-#-#-#-#-#-#- GNUTLS CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_gnutls.so is too complex it describe here, see the wiki: #
# http://wiki.inspircd.org/Modules/ssl_gnutls #
-# #
-# NOTE: If you want to use this module to encrypt and sign your #
-# server to server traffic, you MUST load it before m_spanningtree in #
-# your configuration file! #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# SSL Info module: Allows users to retrieve information about other
@@ -1696,20 +1694,16 @@
#<module name="m_sslinfo.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# OpenSSL ssl module: Adds support for client-server SSL using OpenSSL,
-# if enabled. You must copy the source for this module from the directory
-# src/modules/extra, or answer 'yes' in ./configure when asked if you
-# want to enable this, or it will not load.
+# OpenSSL SSL module: Adds support for SSL connections using OpenSSL,
+# if enabled. You must answer 'yes' in ./configure when asked or symlink
+# the source for this module from the directory src/modules/extra, if
+# you want to enable this, or it will not load.
#<module name="m_ssl_openssl.so">
#
#-#-#-#-#-#-#-#-#-#-#- OPENSSL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_openssl.so is too complex it describe here, see the wiki: #
# http://wiki.inspircd.org/Modules/ssl_openssl #
-# #
-# NOTE: If you want to use this module to encrypt and sign your #
-# server to server traffic, you MUST load it before m_spanningtree in #
-# your configuration file! #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Strip color module: Adds the channel mode +S
@@ -1792,7 +1786,7 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Test line module: Adds the /TLINE command, used to test how many
-# users a /GLINE or /ZLINE etc would match.
+# users a /GLINE or /ZLINE etc. would match.
# This module is oper-only.
# To use, TLINE must be in one of your oper class blocks.
#<module name="m_tline.so">
@@ -1805,10 +1799,9 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# UHNAMES support module: Adds support for the IRCX style UHNAMES
# extension, which displays ident and hostname in the names list for
-# each user, saving clients from doing a WHO on the channel. Note that
-# this module is not widely supported yet. If a client does not support
-# UHNAMES it will not enable it, this will not break incompatible
-# clients.
+# each user, saving clients from doing a WHO on the channel.
+# If a client does not support UHNAMES it will not enable it, this will
+# not break incompatible clients.
#<module name="m_uhnames.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
@@ -1818,8 +1811,8 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Userip module: Adds the /USERIP command
-# This module is oper-only.
-# To use, USERIP must be in one of your oper class blocks.
+# Allows users to query their own IP, also allows opers to query the IP
+# of anyone else.
#<module name="m_userip.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
diff --git a/docs/conf/modules/charybdis.conf.example b/docs/conf/modules/charybdis.conf.example
index 4490d5482..b456278bb 100644
--- a/docs/conf/modules/charybdis.conf.example
+++ b/docs/conf/modules/charybdis.conf.example
@@ -257,20 +257,16 @@
#<module name="m_sslmodes.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# GnuTLS ssl module: Adds support for client-server SSL using GnuTLS,
-# if enabled. You must copy the source for this module from the directory
-# src/modules/extra, or answer 'yes' in ./configure when asked if you
-# want to enable this, or it will not load.
+# GnuTLS SSL module: Adds support for SSL connections using GnuTLS,
+# if enabled. You must answer 'yes' in ./configure when asked or
+# manually symlink the source for this module from the directory
+# src/modules/extra, if you want to enable this, or it will not load.
#<module name="m_ssl_gnutls.so">
#
#-#-#-#-#-#-#-#-#-#-#- GNUTLS CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_gnutls.so is too complex it describe here, see the wiki: #
# http://wiki.inspircd.org/Modules/ssl_gnutls #
-# #
-# NOTE: If you want to use this module to encrypt and sign your #
-# server to server traffic, you MUST load it before m_spanningtree in #
-# your configuration file! #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# SSL Info module: Allows users to retrieve information about other
@@ -288,20 +284,16 @@
#<module name="m_sslinfo.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# OpenSSL ssl module: Adds support for client-server SSL using OpenSSL,
-# if enabled. You must copy the source for this module from the directory
-# src/modules/extra, or answer 'yes' in ./configure when asked if you
-# want to enable this, or it will not load.
+# OpenSSL SSL module: Adds support for SSL connections using OpenSSL,
+# if enabled. You must answer 'yes' in ./configure when asked or symlink
+# the source for this module from the directory src/modules/extra, if
+# you want to enable this, or it will not load.
#<module name="m_ssl_openssl.so">
#
#-#-#-#-#-#-#-#-#-#-#- OPENSSL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_openssl.so is too complex it describe here, see the wiki: #
# http://wiki.inspircd.org/Modules/ssl_openssl #
-# #
-# NOTE: If you want to use this module to encrypt and sign your #
-# server to server traffic, you MUST load it before m_spanningtree in #
-# your configuration file! #
<module name="m_stripcolor.so">
<module name="m_svshold.so">
diff --git a/docs/conf/modules/unrealircd.conf.example b/docs/conf/modules/unrealircd.conf.example
index 2d27b43a0..afd54359c 100644
--- a/docs/conf/modules/unrealircd.conf.example
+++ b/docs/conf/modules/unrealircd.conf.example
@@ -239,7 +239,7 @@
# If you are using the m_operjoin.so module, specify options here: #
# #
# channel - The channel name to join, can also be a comma #
-# seperated list eg. "#channel1,#channel2". #
+# separated list eg. "#channel1,#channel2". #
# #
# override - Lets the oper join walking thru any modes that #
# might be set, even bans. Use "yes" or "no". #
@@ -254,7 +254,7 @@
<module name="m_operlog.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# Oper MOTD module: Provides support for seperate message of the day
+# Oper MOTD module: Provides support for separate message of the day
# on oper-up
# This module is oper-only.
#<module name="m_opermotd.so">
@@ -365,38 +365,30 @@
<module name="m_sslmodes.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# GnuTLS ssl module: Adds support for client-server SSL using GnuTLS,
-# if enabled. You must copy the source for this module from the directory
-# src/modules/extra, or answer 'yes' in ./configure when asked if you
-# want to enable this, or it will not load.
+# GnuTLS SSL module: Adds support for SSL connections using GnuTLS,
+# if enabled. You must answer 'yes' in ./configure when asked or symlink
+# the source for this module from the directory src/modules/extra, if
+# you want to enable this, or it will not load.
#<module name="m_ssl_gnutls.so">
#
#-#-#-#-#-#-#-#-#-#-#- GNUTLS CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_gnutls.so is too complex it describe here, see the wiki: #
# http://wiki.inspircd.org/Modules/ssl_gnutls #
-# #
-# NOTE: If you want to use this module to encrypt and sign your #
-# server to server traffic, you MUST load it before m_spanningtree in #
-# your configuration file! #
<module name="m_sslinfo.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# OpenSSL ssl module: Adds support for client-server SSL using OpenSSL,
-# if enabled. You must copy the source for this module from the directory
-# src/modules/extra, or answer 'yes' in ./configure when asked if you
-# want to enable this, or it will not load.
+# OpenSSL SSL module: Adds support for SSL connections using OpenSSL,
+# if enabled. You must answer 'yes' in ./configure when asked or symlink
+# the source for this module from the directory src/modules/extra, if
+# you want to enable this, or it will not load.
#<module name="m_ssl_openssl.so">
#
#-#-#-#-#-#-#-#-#-#-#- OPENSSL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-#
# #
# m_ssl_openssl.so is too complex it describe here, see the wiki: #
# http://wiki.inspircd.org/Modules/ssl_openssl #
-# #
-# NOTE: If you want to use this module to encrypt and sign your #
-# server to server traffic, you MUST load it before m_spanningtree in #
-# your configuration file! #
<module name="m_stripcolor.so">
<module name="m_svshold.so">
diff --git a/docs/conf/motd.txt.example b/docs/conf/motd.txt.example
index 70830b8da..66fddd344 100644
--- a/docs/conf/motd.txt.example
+++ b/docs/conf/motd.txt.example
@@ -29,7 +29,7 @@
/ * Web: http://www.inspircd.org \
| * IRC: irc.inspircd.org #inspircd |
| * Docs: http://wiki.inspircd.org |
- | * Bugs: http://inspircd.github.com/bugs |
+ | * Bugs: http://inspircd.org/bugs |
| |
| We hope you like this software. Please do |
| make sure you put some effort into |
diff --git a/docs/conf/opermotd.txt.example b/docs/conf/opermotd.txt.example
index c91b36a2b..110cba8e4 100644
--- a/docs/conf/opermotd.txt.example
+++ b/docs/conf/opermotd.txt.example
@@ -29,7 +29,7 @@
/ * Web: http://www.inspircd.org \
| * IRC: irc.inspircd.org #inspircd |
| * Docs: http://wiki.inspircd.org |
- | * Bugs: http://inspircd.github.com/bugs |
+ | * Bugs: http://inspircd.org/bugs |
| |
| We hope you like this software. Please do |
| make sure you put some effort into |
diff --git a/docs/conf/opers.conf.example b/docs/conf/opers.conf.example
index c62de0e55..e7b65b675 100644
--- a/docs/conf/opers.conf.example
+++ b/docs/conf/opers.conf.example
@@ -28,9 +28,9 @@
# - channels/high-join-limit: allows opers with this priv to join <channels:opers> total channels instead of <channels:users> total channels.
# PERMISSIONS:
# - users/flood/no-throttle: allows opers with this priv to send commands without being throttled (*NOTE)
- # - users/flood/increased-buffers: allows opers with this priv to send and recieve data without worrying about being disconnected for exceeding limits (*NOTE)
+ # - users/flood/increased-buffers: allows opers with this priv to send and receive data without worrying about being disconnected for exceeding limits (*NOTE)
#
- # *NOTE: These privs are potantially dangerous, as they grant users with them the ability to hammer your server's CPU/RAM as much as they want, essentially.
+ # *NOTE: These privs are potentially dangerous, as they grant users with them the ability to hammer your server's CPU/RAM as much as they want, essentially.
privs="users/auspex channels/auspex servers/auspex users/mass-message channels/high-join-limit users/flood/no-throttle users/flood/increased-buffers"
# usermodes: Oper-only usermodes that opers with this class can use.
@@ -139,10 +139,12 @@
# Remember: This is case sensitive
name="Brain"
- # hash: what hash this password is hashed with. requires the module
- # for selected hash (m_md5.so, m_sha256.so or m_ripemd160.so) be
- # loaded and the password hashing module (m_password_hash.so)
- # loaded. Options here are: "md5", "sha256" and "ripemd160".
+ # hash: what hash this password is hashed with.
+ # Requires the module for selected hash (m_md5.so, m_sha256.so
+ # or m_ripemd160.so) be loaded and the password hashing module
+ # (m_password_hash.so) loaded.
+ # Options here are: "md5", "sha256" and "ripemd160", or one of
+ # these prefixed with "hmac-", e.g.: "hmac-sha256".
# Create hashed password with: /mkpasswd <hash> <password>
hash="sha256"
diff --git a/include/base.h b/include/base.h
index 117ffab76..c6d361576 100644
--- a/include/base.h
+++ b/include/base.h
@@ -121,7 +121,7 @@ class CoreExport usecountbase
};
template <typename T>
-class CoreExport reference
+class reference
{
T* value;
public:
diff --git a/include/socketengine.h b/include/socketengine.h
index 8e4c3dfc9..d97c0ea9f 100644
--- a/include/socketengine.h
+++ b/include/socketengine.h
@@ -493,6 +493,14 @@ public:
* Checks EAGAIN and WSAEWOULDBLOCK
*/
static bool IgnoreError();
+
+ /** Return the last socket related error. strrerror(errno) on *nix
+ */
+ static std::string LastError();
+
+ /** Returns the error for the given error num, strerror(errnum) on *nix
+ */
+ static std::string GetError(int errnum);
};
inline bool SocketEngine::IgnoreError()
diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp
index b406781b1..75d1ee8ff 100644
--- a/src/commands/cmd_whowas.cpp
+++ b/src/commands/cmd_whowas.cpp
@@ -54,14 +54,6 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use
for (whowas_set::iterator ux = grp->begin(); ux != grp->end(); ux++)
{
WhoWasGroup* u = *ux;
- time_t rawtime = u->signon;
- tm *timeinfo;
- char b[25];
-
- timeinfo = localtime(&rawtime);
-
- strncpy(b,asctime(timeinfo),24);
- b[24] = 0;
user->WriteNumeric(314, "%s %s %s %s * :%s",user->nick.c_str(),parameters[0].c_str(),
u->ident.c_str(),u->dhost.c_str(),u->gecos.c_str());
@@ -70,8 +62,9 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use
user->WriteNumeric(379, "%s %s :was connecting from *@%s",
user->nick.c_str(), parameters[0].c_str(), u->host.c_str());
+ std::string signon = ServerInstance->TimeString(u->signon);
bool hide_server = (!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex"));
- user->WriteNumeric(312, "%s %s %s :%s",user->nick.c_str(), parameters[0].c_str(), (hide_server ? ServerInstance->Config->HideWhoisServer.c_str() : u->server.c_str()), b);
+ user->WriteNumeric(312, "%s %s %s :%s",user->nick.c_str(), parameters[0].c_str(), (hide_server ? ServerInstance->Config->HideWhoisServer.c_str() : u->server.c_str()), signon.c_str());
}
}
else
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 2626da6bb..cfbd53c98 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -437,7 +437,26 @@ bool InspIRCd::SilentULine(const std::string& sserver)
std::string InspIRCd::TimeString(time_t curtime)
{
- return std::string(ctime(&curtime),24);
+#ifdef _WIN32
+ if (curtime < 0)
+ curtime = 0;
+#endif
+
+ struct tm* timeinfo = localtime(&curtime);
+ if (!timeinfo)
+ {
+ curtime = 0;
+ timeinfo = localtime(&curtime);
+ }
+
+ // If the calculated year exceeds four digits or is less than the year 1000,
+ // the behavior of asctime() is undefined
+ if (timeinfo->tm_year + 1900 > 9999)
+ timeinfo->tm_year = 9999 - 1900;
+ else if (timeinfo->tm_year + 1900 < 1000)
+ timeinfo->tm_year = 0;
+
+ return std::string(asctime(timeinfo),24);
}
std::string InspIRCd::GenRandomStr(int length, bool printable)
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index c94f08842..2171e2a9f 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -155,7 +155,7 @@ void InspIRCd::SetSignals()
void InspIRCd::QuickExit(int status)
{
- exit(0);
+ exit(status);
}
bool InspIRCd::DaemonSeed()
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index ec528571b..d7a25785d 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -57,7 +57,7 @@ void BufferedSocket::DoConnect(const std::string &ipaddr, int aport, unsigned lo
if (err != I_ERR_NONE)
{
state = I_ERROR;
- SetError(strerror(errno));
+ SetError(SocketEngine::LastError());
OnError(err);
}
}
@@ -211,7 +211,7 @@ void StreamSocket::DoRead()
}
else
{
- error = strerror(errno);
+ error = SocketEngine::LastError();
ServerInstance->SE->ChangeEventMask(this, FD_WANT_NO_READ | FD_WANT_NO_WRITE);
}
}
@@ -249,11 +249,13 @@ void StreamSocket::DoWrite()
// The length limit of 1024 is to prevent merging strings
// more than once when writes begin to block.
std::string tmp;
- tmp.reserve(sendq_len);
- for(unsigned int i=0; i < sendq.size(); i++)
- tmp.append(sendq[i]);
- sendq.clear();
- sendq.push_back(tmp);
+ tmp.reserve(1280);
+ while (!sendq.empty() && tmp.length() < 1024)
+ {
+ tmp.append(sendq.front());
+ sendq.pop_front();
+ }
+ sendq.push_front(tmp);
}
std::string& front = sendq.front();
int itemlen = front.length();
@@ -295,7 +297,7 @@ void StreamSocket::DoWrite()
if (errno == EINTR || SocketEngine::IgnoreError())
ServerInstance->SE->ChangeEventMask(this, FD_WANT_FAST_WRITE | FD_WRITE_WILL_BLOCK);
else
- SetError(strerror(errno));
+ SetError(SocketEngine::LastError());
return;
}
else if (rv < itemlen)
@@ -400,7 +402,7 @@ void StreamSocket::DoWrite()
}
else
{
- error = strerror(errno);
+ error = SocketEngine::LastError();
}
}
if (!error.empty())
@@ -496,7 +498,7 @@ void StreamSocket::HandleEvent(EventType et, int errornum)
if (errornum == 0)
SetError("Connection closed");
else
- SetError(strerror(errornum));
+ SetError(SocketEngine::GetError(errornum));
switch (errornum)
{
case ETIMEDOUT:
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index dab377397..53fc38ec0 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -47,8 +47,14 @@
/* $CompileFlags: pkgconfincludes("gnutls","/gnutls/gnutls.h","") exec("libgcrypt-config --cflags") -Wno-pedantic */
/* $LinkerFlags: rpath("pkg-config --libs gnutls") pkgconflibs("gnutls","/libgnutls.so","-lgnutls") exec("libgcrypt-config --libs") */
+#ifndef GNUTLS_VERSION_MAJOR
+#define GNUTLS_VERSION_MAJOR LIBGNUTLS_VERSION_MAJOR
+#define GNUTLS_VERSION_MINOR LIBGNUTLS_VERSION_MINOR
+#define GNUTLS_VERSION_PATCH LIBGNUTLS_VERSION_PATCH
+#endif
+
// These don't exist in older GnuTLS versions
-#if ((GNUTLS_VERSION_MAJOR > 2) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR > 1) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR == 1 && GNUTLS_VERSION_MICRO >= 7))
+#if ((GNUTLS_VERSION_MAJOR > 2) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR > 1) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR == 1 && GNUTLS_VERSION_PATCH >= 7))
#define GNUTLS_NEW_PRIO_API
#endif
@@ -115,6 +121,8 @@ class GnuTLSIOHook : public SSLIOHook
#ifdef GNUTLS_NEW_PRIO_API
gnutls_priority_set(session->sess, priority);
+ #else
+ gnutls_set_default_priority(session->sess);
#endif
gnutls_credentials_set(session->sess, GNUTLS_CRD_CERTIFICATE, x509_cred);
gnutls_dh_set_prime_bits(session->sess, dh_bits);
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 4cb6ee07b..29c3568ef 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -184,7 +184,7 @@ class OpenSSLIOHook : public SSLIOHook
certinfo->invalid = (SSL_get_verify_result(session->sess) != X509_V_OK);
- if (SelfSigned)
+ if (!SelfSigned)
{
certinfo->unknownsigner = false;
certinfo->trusted = true;
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index becc7a6e8..3c9d64d49 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -26,7 +26,7 @@
#include "modules/dns.h"
/* Class holding data for a single entry */
-class DNSBLConfEntry
+class DNSBLConfEntry : public refcountbase
{
public:
enum EnumBanaction { I_UNKNOWN, I_KILL, I_ZLINE, I_KLINE, I_GLINE, I_MARK };
@@ -49,11 +49,11 @@ class DNSBLResolver : public DNS::Request
std::string theiruid;
LocalStringExt& nameExt;
LocalIntExt& countExt;
- DNSBLConfEntry *ConfEntry;
+ reference<DNSBLConfEntry> ConfEntry;
public:
- DNSBLResolver(DNS::Manager *mgr, Module *me, LocalStringExt& match, LocalIntExt& ctr, const std::string &hostname, LocalUser* u, DNSBLConfEntry *conf)
+ DNSBLResolver(DNS::Manager *mgr, Module *me, LocalStringExt& match, LocalIntExt& ctr, const std::string &hostname, LocalUser* u, reference<DNSBLConfEntry> conf)
: DNS::Request(mgr, me, hostname, DNS::QUERY_A, true), theiruid(u->uuid), nameExt(match), countExt(ctr), ConfEntry(conf)
{
}
@@ -203,7 +203,7 @@ class DNSBLResolver : public DNS::Request
class ModuleDNSBL : public Module
{
- std::vector<DNSBLConfEntry *> DNSBLConfEntries;
+ std::vector<reference<DNSBLConfEntry> > DNSBLConfEntries;
dynamic_reference<DNS::Manager> DNS;
LocalStringExt nameExt;
LocalIntExt countExt;
@@ -236,36 +236,22 @@ class ModuleDNSBL : public Module
ServerInstance->Modules->AddService(countExt);
}
- ~ModuleDNSBL()
- {
- ClearEntries();
- }
-
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides handling of DNS blacklists", VF_VENDOR);
}
- /** Clear entries and free the mem it was using
- */
- void ClearEntries()
- {
- for (std::vector<DNSBLConfEntry *>::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++)
- delete *i;
- DNSBLConfEntries.clear();
- }
-
/** Fill our conf vector with data
*/
void ReadConf()
{
- ClearEntries();
+ DNSBLConfEntries.clear();
ConfigTagList dnsbls = ServerInstance->Config->ConfTags("dnsbl");
for(ConfigIter i = dnsbls.first; i != dnsbls.second; ++i)
{
ConfigTag* tag = i->second;
- DNSBLConfEntry *e = new DNSBLConfEntry();
+ reference<DNSBLConfEntry> e = new DNSBLConfEntry();
e->name = tag->getString("name");
e->ident = tag->getString("ident");
@@ -325,11 +311,7 @@ class ModuleDNSBL : public Module
/* add it, all is ok */
DNSBLConfEntries.push_back(e);
- continue;
}
-
- /* delete and drop it, error somewhere */
- delete e;
}
}
@@ -410,7 +392,7 @@ class ModuleDNSBL : public Module
unsigned long total_hits = 0, total_misses = 0;
- for (std::vector<DNSBLConfEntry*>::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++)
+ for (std::vector<reference<DNSBLConfEntry> >::const_iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); ++i)
{
total_hits += (*i)->stats_hits;
total_misses += (*i)->stats_misses;
diff --git a/src/modules/m_ircv3.cpp b/src/modules/m_ircv3.cpp
index 59a69f669..f46ae97b4 100644
--- a/src/modules/m_ircv3.cpp
+++ b/src/modules/m_ircv3.cpp
@@ -84,7 +84,7 @@ class ModuleIRCv3 : public Module
void OnRehash(User* user) CXX11_OVERRIDE
{
ConfigTag* conf = ServerInstance->Config->ConfValue("ircv3");
- accountnotify = conf->getBool("accoutnotify", true);
+ accountnotify = conf->getBool("accountnotify", true);
awaynotify = conf->getBool("awaynotify", true);
extendedjoin = conf->getBool("extendedjoin", true);
}
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index 2a3dff6ee..a19a184e0 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -19,9 +19,16 @@
#include "inspircd.h"
+#include "listmode.h"
#include <fstream>
+struct ListModeData
+{
+ std::string modes;
+ std::string params;
+};
+
/** Handles the +P channel mode
*/
class PermChannel : public ModeHandler
@@ -48,8 +55,9 @@ class PermChannel : public ModeHandler
// Not in a class due to circular dependancy hell.
static std::string permchannelsconf;
-static bool WriteDatabase(PermChannel& permchanmode)
+static bool WriteDatabase(PermChannel& permchanmode, Module* mod, bool save_listmodes)
{
+ ChanModeReference ban(mod, "ban");
/*
* We need to perform an atomic write so as not to fuck things up.
* So, let's write to a temporary file, flush it, then rename the file..
@@ -78,9 +86,45 @@ static bool WriteDatabase(PermChannel& permchanmode)
if (!chan->IsModeSet(permchanmode))
continue;
+ std::string chanmodes = chan->ChanModes(true);
+ if (save_listmodes)
+ {
+ ListModeData lm;
+
+ // Bans are managed by the core, so we have to process them separately
+ static_cast<ListModeBase*>(*ban)->DoSyncChannel(chan, mod, &lm);
+
+ // All other listmodes are managed by modules, so we need to ask them (call their
+ // OnSyncChannel() handler) to give our ProtoSendMode() a list of modes that are
+ // set on the channel. The ListModeData struct is passed as an opaque pointer
+ // that will be passed back to us by the module handling the mode.
+ FOREACH_MOD(OnSyncChannel, (chan, mod, &lm));
+
+ if (!lm.modes.empty())
+ {
+ // Remove the last space
+ lm.params.erase(lm.params.end()-1);
+
+ // If there is at least a space in chanmodes (that is, a non-listmode has a parameter)
+ // insert the listmode mode letters before the space. Otherwise just append them.
+ std::string::size_type p = chanmodes.find(' ');
+ if (p == std::string::npos)
+ chanmodes += lm.modes;
+ else
+ chanmodes.insert(p, lm.modes);
+
+ // Append the listmode parameters (the masks themselves)
+ chanmodes += ' ';
+ chanmodes += lm.params;
+ }
+ }
+
stream << "<permchannels channel=\"" << ServerConfig::Escape(chan->name)
+ << "\" ts=\"" << chan->age
<< "\" topic=\"" << ServerConfig::Escape(chan->topic)
- << "\" modes=\"" << ServerConfig::Escape(chan->ChanModes(true))
+ << "\" topicts=\"" << chan->topicset
+ << "\" topicsetby=\"" << ServerConfig::Escape(chan->setby)
+ << "\" modes=\"" << ServerConfig::Escape(chanmodes)
<< "\">" << std::endl;
}
@@ -115,6 +159,7 @@ class ModulePermanentChannels : public Module
{
PermChannel p;
bool dirty;
+ bool save_listmodes;
public:
ModulePermanentChannels() : p(this), dirty(false)
@@ -156,7 +201,9 @@ public:
void OnRehash(User *user) CXX11_OVERRIDE
{
- permchannelsconf = ServerInstance->Config->ConfValue("permchanneldb")->getString("filename");
+ ConfigTag* tag = ServerInstance->Config->ConfValue("permchanneldb");
+ permchannelsconf = tag->getString("filename");
+ save_listmodes = tag->getBool("listmodes");
}
void LoadDatabase()
@@ -170,12 +217,11 @@ public:
{
ConfigTag* tag = i->second;
std::string channel = tag->getString("channel");
- std::string topic = tag->getString("topic");
std::string modes = tag->getString("modes");
- if (channel.empty())
+ if ((channel.empty()) || (channel.length() > ServerInstance->Config->Limits.ChanMax))
{
- ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Malformed permchannels tag with empty channel name.");
+ ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring permchannels tag with empty or too long channel name (\"" + channel + "\")");
continue;
}
@@ -183,20 +229,23 @@ public:
if (!c)
{
- c = new Channel(channel, ServerInstance->Time());
- if (!topic.empty())
+ time_t TS = tag->getInt("ts", ServerInstance->Time(), 1);
+ c = new Channel(channel, TS);
+
+ unsigned int topicset = tag->getInt("topicts");
+ c->topic = tag->getString("topic");
+
+ if ((topicset != 0) || (!c->topic.empty()))
{
- c->SetTopic(ServerInstance->FakeClient, topic);
-
- /*
- * Due to the way protocol works in 1.2, we need to hack the topic TS in such a way that this
- * topic will always win over others.
- *
- * This is scheduled for (proper) fixing in a later release, and can be removed at a later date.
- */
- c->topicset = 42;
+ if (topicset == 0)
+ topicset = ServerInstance->Time();
+ c->topicset = topicset;
+ c->setby = tag->getString("topicsetby");
+ if (c->setby.empty())
+ c->setby = ServerInstance->Config->ServerName;
}
- ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Added %s with topic %s", channel.c_str(), topic.c_str());
+
+ ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Added %s with topic %s", channel.c_str(), c->topic.c_str());
if (modes.empty())
continue;
@@ -242,7 +291,7 @@ public:
void OnBackgroundTimer(time_t) CXX11_OVERRIDE
{
if (dirty)
- WriteDatabase(p);
+ WriteDatabase(p, this, save_listmodes);
dirty = false;
}
@@ -278,6 +327,25 @@ public:
}
}
+ void ProtoSendMode(void* opaque, TargetTypeFlags type, void* target, const std::vector<std::string>& modes, const std::vector<TranslateType>& translate)
+ {
+ // We never pass an empty modelist but better be sure
+ if (modes.empty())
+ return;
+
+ ListModeData* lm = static_cast<ListModeData*>(opaque);
+
+ // Append the mode letters without the trailing '+' (for example "IIII", "gg")
+ lm->modes.append(modes[0].begin()+1, modes[0].end());
+
+ // Append the parameters
+ for (std::vector<std::string>::const_iterator i = modes.begin()+1; i != modes.end(); ++i)
+ {
+ lm->params += *i;
+ lm->params += ' ';
+ }
+ }
+
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for channel mode +P to provide permanent channels",VF_VENDOR);
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index 93320757c..0fb446877 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -124,12 +124,36 @@ CmdResult CommandFJoin::Handle(User* srcuser, std::vector<std::string>& params)
/* First up, apply their channel modes if they won the TS war */
if (apply_other_sides_modes)
{
+ // Need to use a modestacker here due to maxmodes
+ irc::modestacker stack(true);
+ std::vector<std::string>::const_iterator paramit = params.begin() + 3;
+ const std::vector<std::string>::const_iterator lastparamit = ((params.size() > 3) ? (params.end() - 1) : params.end());
+ for (std::string::const_iterator i = params[2].begin(); i != params[2].end(); ++i)
+ {
+ ModeHandler* mh = ServerInstance->Modes->FindMode(*i, MODETYPE_CHANNEL);
+ if (!mh)
+ continue;
+
+ std::string modeparam;
+ if ((paramit != lastparamit) && (mh->GetNumParams(true)))
+ {
+ modeparam = *paramit;
+ ++paramit;
+ }
+
+ stack.Push(*i, modeparam);
+ }
+
std::vector<std::string> modelist;
- modelist.push_back(channel);
- /* Remember, params[params.size() - 1] is userlist, and we don't want to apply *that* */
- modelist.insert(modelist.end(), params.begin()+2, params.end()-1);
- ServerInstance->Modes->Process(modelist, srcuser, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE);
+ // Mode parser needs to know what channel to act on.
+ modelist.push_back(params[0]);
+
+ while (stack.GetStackedLine(modelist))
+ {
+ ServerInstance->Modes->Process(modelist, srcuser, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE);
+ modelist.erase(modelist.begin() + 1, modelist.end());
+ }
}
irc::modestacker modestack(true);
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 98f9a304b..9ece3c03d 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -669,6 +669,13 @@ void ModuleSpanningTree::OnUnloadModule(Module* mod)
sock->Close();
}
}
+
+ for (SpanningTreeUtilities::TimeoutList::const_iterator i = Utils->timeoutlist.begin(); i != Utils->timeoutlist.end(); ++i)
+ {
+ TreeSocket* sock = i->first;
+ if (sock->GetIOHook() && sock->GetIOHook()->creator == mod)
+ sock->Close();
+ }
}
// note: the protocol does not allow direct umode +o except
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 9e6f41852..164bed1ca 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -50,6 +50,7 @@ class SpanningTreeUtilities : public classbase
public:
typedef std::set<TreeSocket*> TreeSocketSet;
+ typedef std::map<TreeSocket*, std::pair<std::string, int> > TimeoutList;
/** Creator module
*/
@@ -91,7 +92,7 @@ class SpanningTreeUtilities : public classbase
server_hash sidlist;
/** List of all outgoing sockets and their timeouts
*/
- std::map<TreeSocket*, std::pair<std::string, int> > timeoutlist;
+ TimeoutList timeoutlist;
/** Holds the data from the <link> tags in the conf
*/
std::vector<reference<Link> > LinkBlocks;
diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp
index 97e4c9284..79e69ec5e 100644
--- a/src/modules/m_userip.cpp
+++ b/src/modules/m_userip.cpp
@@ -36,7 +36,7 @@ class CommandUserip : public Command
std::string retbuf = "340 " + user->nick + " :";
int nicks = 0;
bool checked_privs = false;
- bool has_privs;
+ bool has_privs = false;
for (int i = 0; i < (int)parameters.size(); i++)
{
diff --git a/src/socketengine.cpp b/src/socketengine.cpp
index 80e9eaed9..219d154f2 100644
--- a/src/socketengine.cpp
+++ b/src/socketengine.cpp
@@ -255,3 +255,26 @@ void SocketEngine::GetStats(float &kbitpersec_in, float &kbitpersec_out, float &
kbitpersec_in = in_kbit / 1024;
kbitpersec_out = out_kbit / 1024;
}
+
+std::string SocketEngine::LastError()
+{
+#ifndef _WIN32
+ return strerror(errno);
+#else
+ char szErrorString[500];
+ DWORD dwErrorCode = WSAGetLastError();
+ if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)szErrorString, _countof(szErrorString), NULL) == 0)
+ sprintf_s(szErrorString, _countof(szErrorString), "Error code: %u", dwErrorCode);
+ return szErrorString;
+#endif
+}
+
+std::string SocketEngine::GetError(int errnum)
+{
+#ifndef _WIN32
+ return strerror(errnum);
+#else
+ WSASetLastError(errnum);
+ return LastError();
+#endif
+}
diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp
index 68f14cc38..099f793a1 100644
--- a/src/socketengines/socketengine_epoll.cpp
+++ b/src/socketengines/socketengine_epoll.cpp
@@ -63,7 +63,7 @@ EPollEngine::EPollEngine()
{
ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets!");
std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl;
- ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+ ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
}
// This is not a maximum, just a hint at the eventual number of sockets that may be polled.
@@ -75,7 +75,7 @@ EPollEngine::EPollEngine()
ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now.");
std::cout << "ERROR: Could not initialize epoll socket engine: " << strerror(errno) << std::endl;
std::cout << "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now." << std::endl;
- ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+ ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
}
ref = new EventHandler* [GetMaxFds()];
diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp
index a6c84133a..99ac51499 100644
--- a/src/socketengines/socketengine_kqueue.cpp
+++ b/src/socketengines/socketengine_kqueue.cpp
@@ -74,7 +74,7 @@ KQueueEngine::KQueueEngine()
{
ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets!");
std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl;
- ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+ ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
}
this->RecoverFromFork();
@@ -97,7 +97,7 @@ void KQueueEngine::RecoverFromFork()
ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: this is a fatal error, exiting now.");
std::cout << "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features." << std::endl;
std::cout << "ERROR: this is a fatal error, exiting now." << std::endl;
- ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+ ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
}
CurrentSetSize = 0;
}
diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp
index 37f4b6836..493b22630 100644
--- a/src/socketengines/socketengine_poll.cpp
+++ b/src/socketengines/socketengine_poll.cpp
@@ -32,15 +32,15 @@
#include "socketengine.h"
#ifndef _WIN32
- #ifndef __USE_XOPEN
- #define __USE_XOPEN /* fuck every fucking OS ever made. needed by poll.h to work.*/
- #endif
- #include <poll.h>
- #include <sys/poll.h>
+# ifndef __USE_XOPEN
+# define __USE_XOPEN /* fuck every fucking OS ever made. needed by poll.h to work.*/
+# endif
+# include <poll.h>
+# include <sys/poll.h>
+# include <sys/resource.h>
#else
- /* *grumble* */
- #define struct pollfd WSAPOLLFD
- #define poll WSAPoll
+# define struct pollfd WSAPOLLFD
+# define poll WSAPoll
#endif
class InspIRCd;
@@ -73,40 +73,20 @@ public:
#endif
-#ifdef BSD
- #include <sys/sysctl.h>
-#else
- #include <ulimit.h>
-#endif
-
PollEngine::PollEngine()
{
CurrentSetSize = 0;
-#ifdef BSD
- int mib[2];
- size_t len;
-
- mib[0] = CTL_KERN;
-#ifdef KERN_MAXFILESPERPROC
- mib[1] = KERN_MAXFILESPERPROC;
-#else
- mib[1] = KERN_MAXFILES;
-#endif
- len = sizeof(MAX_DESCRIPTORS);
- sysctl(mib, 2, &MAX_DESCRIPTORS, &len, NULL, 0);
-#else
- int max = ulimit(4, 0);
- if (max > 0)
+ struct rlimit limits;
+ if (!getrlimit(RLIMIT_NOFILE, &limits))
{
- MAX_DESCRIPTORS = max;
+ MAX_DESCRIPTORS = limits.rlim_cur;
}
else
{
ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets: %s", strerror(errno));
std::cout << "ERROR: Can't determine maximum number of open sockets: " << strerror(errno) << std::endl;
- ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+ ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
}
-#endif
ref = new EventHandler* [GetMaxFds()];
events = new struct pollfd[GetMaxFds()];
diff --git a/src/socketengines/socketengine_ports.cpp b/src/socketengines/socketengine_ports.cpp
index 8a2fb87f4..ba4e8f2d7 100644
--- a/src/socketengines/socketengine_ports.cpp
+++ b/src/socketengines/socketengine_ports.cpp
@@ -76,7 +76,7 @@ PortsEngine::PortsEngine()
{
ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets!");
std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl;
- ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+ ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
}
EngineHandle = port_create();
@@ -86,7 +86,7 @@ PortsEngine::PortsEngine()
ServerInstance->Logs->Log("SOCKET", LOG_SPARSE, "ERROR: This is a fatal error, exiting now.");
std::cout << "ERROR: Could not initialize socket engine: " << strerror(errno) << std::endl;
std::cout << "ERROR: This is a fatal error, exiting now." << std::endl;
- ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+ ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
}
CurrentSetSize = 0;
diff --git a/src/socketengines/socketengine_select.cpp b/src/socketengines/socketengine_select.cpp
index de366266f..f995b5472 100644
--- a/src/socketengines/socketengine_select.cpp
+++ b/src/socketengines/socketengine_select.cpp
@@ -177,7 +177,9 @@ int SelectEngine::DispatchEvents()
if (has_write)
{
WriteEvents++;
- SetEventMask(ev, ev->GetEventMask() & ~(FD_WRITE_WILL_BLOCK | FD_WANT_SINGLE_WRITE));
+ int newmask = (ev->GetEventMask() & ~(FD_WRITE_WILL_BLOCK | FD_WANT_SINGLE_WRITE));
+ this->OnSetEvent(ev, ev->GetEventMask(), newmask);
+ SetEventMask(ev, newmask);
ev->HandleEvent(EVENT_WRITE);
}
}
diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp
index c1b964430..e16e401f3 100644
--- a/src/threadengines/threadengine_pthread.cpp
+++ b/src/threadengines/threadengine_pthread.cpp
@@ -80,6 +80,8 @@ class ThreadSignalSocket : public EventHandler
~ThreadSignalSocket()
{
+ ServerInstance->SE->DelFd(this);
+ ServerInstance->SE->Close(GetFd());
}
void Notify()
@@ -104,6 +106,7 @@ class ThreadSignalSocket : public EventHandler
SocketThread::SocketThread()
{
+ signal.sock = NULL;
int fd = eventfd(0, EFD_NONBLOCK);
if (fd < 0)
throw new CoreException("Could not create pipe " + std::string(strerror(errno)));
@@ -127,6 +130,8 @@ class ThreadSignalSocket : public EventHandler
~ThreadSignalSocket()
{
close(send_fd);
+ ServerInstance->SE->DelFd(this);
+ ServerInstance->SE->Close(GetFd());
}
void Notify()
@@ -152,6 +157,7 @@ class ThreadSignalSocket : public EventHandler
SocketThread::SocketThread()
{
+ signal.sock = NULL;
int fds[2];
if (pipe(fds))
throw new CoreException("Could not create pipe " + std::string(strerror(errno)));
@@ -166,4 +172,9 @@ void SocketThread::NotifyParent()
SocketThread::~SocketThread()
{
+ if (signal.sock)
+ {
+ signal.sock->cull();
+ delete signal.sock;
+ }
}
diff --git a/src/threadengines/threadengine_win32.cpp b/src/threadengines/threadengine_win32.cpp
index 529e24a29..ea37892f8 100644
--- a/src/threadengines/threadengine_win32.cpp
+++ b/src/threadengines/threadengine_win32.cpp
@@ -35,17 +35,11 @@ void ThreadEngine::Start(Thread* thread)
if (data->handle == NULL)
{
+ DWORD lasterr = GetLastError();
thread->state = NULL;
delete data;
- std::string err = "Unable to create new thread: ";
-#ifdef _WIN32
- CHAR errdetail[100];
- FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), errdetail, 100, 0);
+ std::string err = "Unable to create new thread: " + ConvToStr(lasterr);
SetLastError(ERROR_SUCCESS);
- err += errdetail;
-#else
- err += dlerror();
-#endif
throw CoreException(err);
}
}
diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp
index 2836674bb..eba18dca3 100644
--- a/win/inspircd_win32wrapper.cpp
+++ b/win/inspircd_win32wrapper.cpp
@@ -222,10 +222,3 @@ DWORD CWin32Exception::GetErrorCode()
{
return dwErrorCode;
}
-
-#include "../src/modules/m_spanningtree/link.h"
-#include "modules/ssl.h"
-template class reference<Link>;
-template class reference<Autoconnect>;
-template class reference<ssl_cert>;
-template class reference<OperInfo>;