Commit Graph

2196 Commits

Author SHA1 Message Date
Alexander Barton c4245220de Fix MatchCaseInsensitive[List]](): lowercase string _and_ pattern
Up to now, only the the string ("haystack") became lowercased and was
the compared to the pattern ("needle") -- which failed, when the pattern
itself wasn't all lowercase ...
2015-05-13 23:47:53 +02:00
Alexander Barton f8f7f83f5a Streamline effect of "MorePrivacy" option (WHOIS, LIST)
- Update documentation in ngircd.conf(5)
- LIST: Don't hide channels for IRC Ops when "MorePrivacy" is in effect
- WHOIS: Don't hide IP addresses/hostnames when "MorePrivacy" is in effect

Closes #198
2015-05-13 22:42:51 +02:00
LucentW 03c8997af3 Fixed building issues\
Now builds cleanly. Pass all tests from make check.
2015-05-13 20:08:26 +00:00
LucentW 4396936f38 Implement timestamp tracking of invites
Now lists nodes also have the "onlyonce" field, since the valid_until is
used to keep the timestamp of placing. Found no references to onlyonce
or about valid_until being == 1, though, so it might be unused, but
still available for other enhancements.
2015-05-11 22:15:01 +02:00
LucentW 4da04640e6 Keep track of who placed bans/invites/excepts
Implements #203.
WARNING: it does not track the time of placement of invites, since the
time_t is already used as a flag for single use invites!
2015-05-11 22:15:00 +02:00
LucentW 10c7ba99e7 IRC operators w/OperCanMode can kick anyone 2015-05-11 22:12:30 +02:00
LucentW a4af9024fd Fixed indents 2 2015-04-29 20:29:00 +02:00
LucentW 6fc53558ed Fixed indents and documentation
(also updated the copyright date on the txt I edited)
2015-04-29 20:25:18 +02:00
LucentW 21767c968d Implement +I (private channel list on whois)
Implements enhancement requested in issue #179
2015-04-29 14:04:06 +02:00
Alexander Barton c5da483685 Make sure that the target user is able to join a local channel
Implement ERR_USERNOTONSERV(504) numeric and make sure that the
target user is on the same server when inviting other users to
local ("&") channels.

ircd-ratbox uses the ERR_USERNOTONSERV(504) numeric for this, and I
think this is a good idea -- other IRC daemons (like ircu) silently
drop such impossible invites, but thats not a big benefit ...

Idea by Cahata, thanks! Closes #183.
2015-04-12 20:59:43 +02:00
Alexander Barton 4330f5d1c9 INVITE command: Enforce 1 second penalty time
This prevents flooding of the target client.

This closes #186. Reported by Cahata, thanks!
2015-04-12 20:14:24 +02:00
Alexander Barton 81b81c818c MODE command: Always report channel creation time
Up to now when receiving a MODE command, ngIRCd only reported the channel
creation time to clients that were members of the channel. This patch
reports the channel creation time to all clients, regardless if they are
joined to that channel or not.

At least ircd-seven behaves like this.

This closes #188. Thanks Cahata!
2015-04-12 19:39:20 +02:00
Alexander Barton c7bbc9a390 Fix spelling of RPL_WHOISBOT message text 2015-03-27 22:51:21 +01:00
Alexander Barton 6171beb7ab Don't send nick name as default PART reason
No other IRC daemon seems to do this (today?), don't remember why
ngIRCd did it in the first place ...

Closes #185.

Reported by Cahata in #ngircd, thanks!
2015-03-14 11:13:50 +01:00
Alexander Barton 2196e945e4 Fix "WHO #<chan>" showing invisible users and hiding all visible
The logic is reversed ...

This bug has been introduced by commit c74115f2, "Simplify mode checking on
channels and users within a channel", ngIRCd releases 21, 21.1, and 22 are
affected :-(

Problem reported by Cahata in #ngircd, Thanks!
2015-03-14 10:16:16 +01:00
Alexander Barton f16eb1b686 Fix typo in src/testsuite/README 2015-03-11 22:14:24 +01:00
Alexander Barton c41f18e3f9 Auth PING: Fix our information text for manual sending of "PONG"
Up to now, ngIRCd doesn't send a valid IRC command at all, oops!
2015-01-20 22:50:13 +01:00
Alexander Barton dbfe1beca8 Auth PING: The numeric ID is a "long", use atol() 2015-01-20 22:49:23 +01:00
Alexander Barton 6bdae55177 Auth PING: Don't send a prefix in our PING command
The prefix confuses WeeChat, at least, which doesn't send an appropriate
PONG in the case ...

Debugging and patch by "wowaname" on #ngircd, thanks!
2015-01-20 22:44:36 +01:00
Alexander Barton bd8d4e710c Fix syntax of ERR_LISTFULL_MSG(478) numeric
Pointed out by "wowaname" in #ngircd, thanks!
2014-12-27 01:50:27 +01:00
Alexander Barton 9a931a549b Enhance debug messages while sending CHANINFO commands 2014-12-20 15:35:49 +01:00
Alexander Barton 3c30490d54 Reset "last try" timer when enabling a passive server
This results in a new connection attempt as soon as possible.
2014-12-20 15:31:55 +01:00
Alexander Barton 6250335352 Change log message for "Can't resolve address" 2014-12-10 11:11:42 +01:00
Alexander Barton 7e14bd3b58 Change log messages issued for IP address forgeries 2014-12-10 11:02:03 +01:00
Alexander Barton 31b3c83c1f Merge remote-tracking branch 'alex/TestsuiteNoDNS'
* alex/TestsuiteNoDNS:
  Test suite: Don't use DNS lookups
2014-11-01 20:14:09 +01:00
Alexander Barton 100de3e4cc Update "CipherList" to not enable SSLv3 by default
Idea, initial patch, and testing by Christoph Biedl
<ngircd.anoy@manchmal.in-ulm.de>
2014-10-16 13:42:24 +02:00
Alexander Barton be88707027 Match list patterns case-insensitive
The invite-, ban-, and except lists are affected by this change,
as well as G-Lines an K-Lines.

Problem pointed out by "wowaname" on #ngircd, thanks!
2014-10-06 21:47:34 +02:00
Alexander Barton 84ff5a6eb9 Sync "except lists" between servers
Up to now, ban, invite, and G-Line lists have been synced between servers
while linking -- but obviously nobody noticed that except list have been
missing ever since. Until now.

Thanks to "j4jackj", who reported this issue in #ngircd.
2014-09-22 02:17:04 +02:00
Alexander Barton bf2eae3249 Allow longer usernames for authentication 2014-09-11 22:04:31 +02:00
Alexander Barton ffad2da835 Correctly check that a server has a valid hostname and port
David Binderman <dcb314@hotmail.com> reported the following compiler warning,
which is a real bug in ngIRCd, thanks!

conn.c:2077:55: warning: logical not is only applied to the left hand
                         side of comparison [-Wlogical-not-parentheses]
2014-09-10 13:03:30 +02:00
Alexander Barton 896d45471a Lists_MakeMask: Don't destroy source buffer 2014-08-08 13:50:48 +02:00
Alexander Barton 01c3552140 Initialize Conf_ScrubCTCP even when SYSLOG isn't #define'd
The "SYSLOG" #define isn't related to "Conf_ScrubCTCP" at all, so
initialize the latter even when "SYSLOG" isn't #define'd.

Pointed out by wowaname on #ngircd, thanks!
2014-07-29 23:08:18 +02:00
Alexander Barton 40ed94a1f2 Increase MAX_SERVERS from 16 to 64
There are installations out there that would like to configure more
than 16 links per server, so increase this limit. Best would be to
get rid of MAX_SERVERS altogether and make if fully dynamic, but
start with this quick and dirty hack ...
2014-07-20 13:19:36 +02:00
Alexander Barton 3f807e1045 Test suite: Don't use DNS lookups
Different operating systems do behave quite differently when doing DNS
lookups, for example "127.0.0.1" sometimes resolves to "localhost" and
sometimes to "localhost.localdomain" (for example OpenBSD). And other
systems resolve "localhost" to the real host name (for example Cygwin).

So not using DNS at all makes the test site much more portable.
2014-06-09 02:15:52 +02:00
Alexander Barton 39b8fc65b6 Add "tests-skipped.lst" to src/testsuite/.gitignore 2014-06-04 12:20:31 +02:00
Alexander Barton 3de972e0bd Test suite/platformtest.sh: Detect when tests have been skipped
Detect if some tests have been skipped, for example when telnet(1) or expect(1)
is missing: ./contrib/platformtest.sh will echo a warning message now.
2014-06-04 12:15:23 +02:00
Alexander Barton a90004b913 Test suite: Update file headers and comments 2014-04-17 23:56:36 +02:00
Alexander Barton d314c75a37 Allow "DefaultUserModes" to set all possible modes
Let IRC_MODE() detect that the "fake" MODE command originated on the local
sever, which enables all modes to be settable using "DefaultUserModes"
that can be set by regular MODE commands, including modes only settable by
IRC Operators.
2014-03-18 16:43:21 +01:00
Alexander Barton 5009ab3e8c Spoofed prefixes: Really kill connection on non-server links
This fixes commit 6cbe1308 which only killed the connection when the
spoofed prefix itself belonged to a non-server client.
2014-03-18 16:30:38 +01:00
Alexander Barton 5713c49c84 Implement user mode "F": "relaxed flood protection"
ngIRCd relaxes its flood protection for users having the user mode "F" set
and allows them to rapidly send data to the daemon. This mode is only
settable by IRC Operators and can cause problems in the network -- so be
careful and only set it on "trusted" clients!

User mode "F" is used by Bahamut for this purpose, for example, see
<http://docs.dal.net/docs/modes.html#4.9>.
2014-03-18 14:55:38 +01:00
Alexander Barton 35f1db5f28 Handle "throttling" in a single function
ngIRCd uses "command throttling" and "bps throttling" (bytes per second).
The states are detected in different functions, Conn_Handler() and
Read_Request(), but handle the actual "throttling" in a common function:
this enables us to guarantee consistent behavior and to disable throttling
for special connections in only one place, eventually.
2014-03-18 14:53:29 +01:00
Alexander Barton f547981188 Streamline DEBUG_ARRAY, DEBUG_BUFFER, DEBUG_IO, DEBUG_ZIP
Change all #define's to follow the form
	#define DEBUG_xxx {0|1}
to disable (0, default) or enable (1) additional debug messages.

And somewhat enhance some DEBUG_BUFFER messages.
2014-03-17 23:54:44 +01:00
Alexander Barton b35f8916a5 conn.c: Code cleanup
Reformat and restructure some code, move all SSL related code into
one single #ifdef block, for example.
2014-03-17 22:59:58 +01:00
Alexander Barton a534e71e8d Re-add #include's for header files of the C file itself
This partially reverts commit b130b35f4, "Update #include's: remove
unused and add missing ones", but fixes the following compiler and
analyzer warnings of Apple Xcode 5:

 "Semantic issue: No previous prototype for function 'yyy'"
2014-03-17 18:02:57 +01:00
Alexander Barton a13bb78b1e Update copyright notices of recently changed files 2014-03-17 12:22:00 +01:00
Alexander Barton b130b35f48 Update #include's: remove unused and add missing ones
The "deheader" tool (<http://www.catb.org/~esr/deheader/>) has been
used to find unused #include directives as well as missing ones.

Tested on:

- A/UX 3.1.1
- ArchLinux (2014-03-17)
- Debian GNU/Hurd
- Debian GNU/Linux 6.0.9
- Debian GNU/Linux 7.4
- Fedora 20
- FreeBSD 9.2
- OpenBSD 4.8
- OpenBSD 5.1
- OS X 10.9
- Solaris 11
2014-03-17 11:37:25 +01:00
Alexander Barton 37090a28e8 portab.h: Restructure and clean up code
- Don't use HAVE_SYS_TYPES_H, <sys/types.h> is a required header now.
- Streamline check for boolean data types.
- Better indent #ifdef constructs.
2014-03-17 01:17:30 +01:00
Alexander Barton 7b10a0e4ee io.c: <sys/time.h> is only needed when using select()
Only include the <sys/time.h> header when using the select() IO API,
it isn't required otherwise.
2014-03-17 00:45:07 +01:00
Alexander Barton 259c314d14 Remove imp.h and exp.h header files
These include files don't have a function any more, remove them.
2014-03-17 00:17:02 +01:00
Alexander Barton 51396f8f1c strdup.c: Code cleanup 2014-03-16 22:59:03 +01:00
Alexander Barton 6238196dac Don't define SSL_Want{Read|Write}() when SSL is disabled
Not even call the "dummy" functions.
2014-03-16 22:31:23 +01:00
Alexander Barton 43fb18f2f5 Code cleanup, remove blank lines 2014-03-16 22:11:26 +01:00
Alexander Barton a4ed90ba9a Fix two K&R C portability issues
Fix the following two errors emitted by the Apple K&R C compiler
on Apple A/UX:

"./class.c", line 47: no automatic aggregate initialization
"./class.c", line 47: illegal lhs of assignment operator

"./conf.c", line 1052: syntax error

Tested on A/UX 3.1.1.
2014-03-16 20:07:08 +01:00
Roy Sindre Norangshol 485d0aec81 Use server password when PAM is compiled in but disabled 2014-02-28 10:53:40 +01:00
Alexander Barton abf280d5bd CHARCONV: Fix handling conversion errors
Don't overwrite already converted text!
2014-02-23 18:20:47 +01:00
Alexander Barton ccc9e1baa4 Streamline punctuation of log messages
See commit d38d153f for details.
2014-02-09 16:01:13 +01:00
Alexander Barton 384b27cee0 IRC_INVITE(): Code cleanup 2014-02-02 00:27:24 +01:00
Alexander Barton 6496fa4655 Streamline punctuation of log messages
See commit d38d153f for details.
2014-02-02 00:27:03 +01:00
Alexander Barton 20b52fe33d Correctly use cloaked IRC masks on "INVITE nickname"
The cloaked IRC mask of a user is his visible mask, so the daemon has
to use it for generating the "one time" entries for the invite list of
the given channel.

Without this patch, ngIRCd records the real IRC mask which will never
match while the target client is "+x", and even worse, will disclose
the real mask on "MODE #channel +I" commands :-/

Bug reported by Cahata on #ngircd, thanks!
2014-01-27 23:05:29 +01:00
Alexander Barton 0fc822d8c4 Use correct sender as target for ISUPPORT replies on "VERSION"
This fixes commit 2e168c78 ("Return ISUPPORT(005) numerics on
'VERSION'") and make sure, that the 005 numerics are correctly
routed back to the sender.
2014-01-27 22:23:47 +01:00
Alexander Barton 2e168c7809 Return ISUPPORT(005) numerics on "VERSION"
This is how ircd-seven, Charybdis, Hybrid, and InspIRCd behave,
for example.
2014-01-26 23:41:59 +01:00
Mantas Mikulėnas e273bd226a Show account name in WHOIS
This uses the same numeric as Charybdis and ircu families.
2014-01-20 14:25:11 +02:00
Alexander Barton 599cfd0944 Merge branch 'no-range-matching' of git://arthur.barton.de/ngircd-alex
* 'no-range-matching' of git://arthur.barton.de/ngircd-alex:
  Remove "range matching" functionality
2014-01-17 23:11:37 +01:00
Alexander Barton e747fe9277 Fix configure script and "make check" for TCP Wrappers
Add missing #include's and static variables.

Problem spotted on OpenBSD.
2014-01-17 16:18:55 +01:00
Alexander Barton e73d70ce6f Remove "range matching" functionality
Don't support "range marching" in our pattern matching code using
the "[...]" syntax, because [ and ] are valid characters in nick
names and one has to quote them currently using the "\" character,
which is quite unexpected. For example:

  Nick "te[st" => "MODE #channel +b te\[st"

And remove quoting altogether, too, because "*" and "?" don't need
to be quoted because these characters are not allowed in IRC masks,
nicks, and hostnames.

Reported by "hifi" (Toni Spets) on IRC, thanks!
2014-01-15 14:58:57 +01:00
Alexander Barton fe73835666 Client_SetHostname(): Don't use strlen() to test for value 2014-01-10 19:57:05 +01:00
Alexander Barton 5b4b7e2f55 Test suite: explicitely enable glibc memory checking 2014-01-10 19:56:14 +01:00
Alexander Barton 8ae2cdfce9 Send "fake '*' key" in "MODE -k" replies
According to RFC 2812 3.2.3 "Channel mode message" and the examples
there, it looks like clients should use "MODE -k <key>" to unset channel
keys; and that's how other servers and services behave and do expect it.

(But please note that this is NOT the case for "MODE -l"!)

In the end, it doesn't make sense to specify a key when UNsetting it at
all, and different services behave diffrently when clients do not send
the currently set key to unset it - some ignore such calls, for example!

But this implementation is quite relaxed, it accepts any key when
unsetting channel mode "k" and even accepts no key at all. But the reply
will always include an "*" character for every "-k" parameter.
2014-01-08 14:24:03 +01:00
Alexander Barton 5d88030bd1 Support non-standard vsnprintf() return code
C99 states that vsnprintf() "returns the number of characters that
would have been printed if the n were unlimited"; but according to the
Linux manual page "glibc until 2.0.6 would return -1 when the output
was truncated" -- so we have to handle both cases ...
2014-01-04 23:57:05 +01:00
Alexander Barton 788da901ee Update Copyright notices for 2014 2014-01-02 15:27:07 +01:00
Alexander Barton 2a40112f09 Merge branch 'bug167-WebircIPAnoDNS' of git://arthur.barton.de/ngircd-alex
* 'bug167-WebircIPAnoDNS' of git://arthur.barton.de/ngircd-alex:
  WEBIRC: Don't respect hostname when DNS is disabled
2014-01-02 00:45:05 +01:00
Alexander Barton 61b7932e82 Merge branch 'bug165-005-NETWORK' of git://arthur.barton.de/ngircd-alex
* 'bug165-005-NETWORK' of git://arthur.barton.de/ngircd-alex:
  Implement new configuration option "Network"
2014-01-02 00:44:42 +01:00
Alexander Barton f024a4992a portabtest: Add checks for strdup(), strndup(), and strtok_r() 2014-01-01 16:38:36 +01:00
Alexander Barton d38747d951 portabtest: Actually test functions
Test functions snprintf(), strlcpy(), strlcat(), vsnprintf() for
correctness, not only existance (which was quite useless, because
if they weren't available, the program could not have been linked
at all ...).
2014-01-01 15:57:34 +01:00
Alexander Barton 18070e5381 portabtest: Only use one exit code to indicate errors 2013-12-29 17:48:25 +01:00
Alexander Barton d913323ca9 portabtest: Code cleanup 2013-12-29 17:46:54 +01:00
Federico G. Schwindt 9230f2fff1 Fix permanent k/gline
Reported by Toni Spets (hifi - at - jnz - dot - fi).
2013-12-29 01:14:28 +01:00
Alexander Barton 86bdf6e1d4 Implement new configuration option "Network"
The new configuration variable "Network" is used to set the (completely
optional) "network name", to which this instance of the daemon belongs.
When set, this name is used in the ISUPPORT(005) numeric which is sent to
all clients connecting to the server after logging in.

Closes bug #165.
2013-12-27 23:16:11 +01:00
Alexander Barton 1a628fff51 WEBIRC: Don't respect hostname when DNS is disabled
When DNS lookups are disabled, don't set the hostname received by the
WEBIRC command, but use the IP address instead.

Reported by Toni Spets <toni.spets@iki.fi>, thanks!

Closes bug #167.
2013-12-27 22:34:47 +01:00
Alexander Barton b8433e9261 Check for working getaddrinfo() function
At least AIX 4.3.3 and 5.1 have a broken implementation of getaddrinfo()
which doesn't handle "0" as numeric service correctly. This patch adds
a configure check for this case and changes all calling functions to only
use getaddrinfo() if it "works".

See <http://www.stacken.kth.se/lists/heimdal-discuss/2004-05/msg00059.html>
2013-12-27 21:35:13 +01:00
Federico G. Schwindt 5a424f60da Fix spelling 2013-12-07 22:48:31 +00:00
Alexander Barton ae00c100ac Only use unsetenv() when it is available
AIX 4.3 dosn't support it, for example.
2013-11-10 17:08:51 +01:00
Alexander Barton 61d1c864c5 conf-ssl.h: make code compatible with pre-ANSI C compilers 2013-11-09 23:42:56 +01:00
Alexander Barton 8d25044ce5 vsnprintf.c: make code compatible with ansi2knr tool 2013-11-09 23:41:20 +01:00
Alexander Barton c3c719b978 Remove unused vsnprintf.c test function 2013-11-09 23:31:51 +01:00
Federico G. Schwindt 9ee3760493 Add comments around some IRC_SetPenalty() calls 2013-11-07 18:17:58 +00:00
Federico G. Schwindt 344185b1bd Rework the penalty handling slightly
Increase the penalty for a command before checking its arguments.  This
makes the handling more consistent and allow us to move more penalties to
Handle_Request().
2013-11-07 16:53:29 +00:00
Federico G. Schwindt fcf61e9e02 Move IRC_SetPenalty() to Handle_Request() when possible
This centralizes the penalty handling. It also exposes some commands that
lack it for our attention.
2013-11-07 16:29:21 +00:00
Federico G. Schwindt 9f236c4b91 Introduce a macro to define the command list
This will pave the way to other changes and simplifies the entries somewhat.
2013-11-07 13:20:08 +00:00
Federico G. Schwindt 00249f3c80 When sending an error use the IRC_WriteErrClient() variant
This ensures that all errors have a 2 second penalty.
2013-11-07 10:45:34 +00:00
Federico G. Schwindt 925b4de298 On bad /oper set the penalty to 10 seconds
This helps against brute-force attempts.
2013-11-06 21:46:53 +00:00
Federico G. Schwindt 48ea69d778 Remove unneded IRC_SetPenalty() calls
IRC_WriteErrClient() already calls IRC_SetPenalty().  While here convert
some IRC_SetPenalty() + IRC_WriteStrClient() to IRC_WriteErrClient().
2013-11-06 18:28:09 +00:00
Federico G. Schwindt 80d0613bf2 Use sizeof() intead of the explicit size 2013-11-06 18:25:11 +00:00
Alexander Barton 4ab688c5e8 Remove wrong #ifdef in Option_String()
This fixes the following error when compiling without zlib support:

  irc.c: In function ‘Option_String’:
  irc.c:487: error: ‘options’ undeclared (first use in this function)

Reported by "der_baer" on #ngircd.
2013-11-01 19:12:35 +01:00
Federico G. Schwindt 8e6db769ac Check and call arc4random_stir() if present
FreeBSD prior to 10.0 does not automatically stir on fork(). Same with
current NetBSD. If arc4random_stir() is present assume is needed and
call it instead of srand().
2013-10-23 16:00:26 +01:00
Federico G. Schwindt 62865f7e19 Add support for longer config lines
With the introduction of CipherList we could have longer config lines.
Handle up to 1024 bytes and warn if the line will be truncated.
2013-10-17 22:10:53 +01:00
Federico G. Schwindt a7dda1b28c Report the correct file on error 2013-10-17 21:52:15 +01:00
Federico G. Schwindt 17589534d0 Add support for arc4random
If arc4random is present it will be used over the srand/rand interface.
This fixes some warnings in OpenBSD-current.
2013-10-16 16:32:06 +01:00
Federico G. Schwindt ea26fd2840 Fix another strcat warning missed in commit 4c5b43 2013-10-16 10:41:40 +01:00
Alexander Barton 4c5b439992 ngircd.c, main(): use strlcat() instead of strcat()
This fixes the following warning on OpenBSD 5.3:

 ngircd.o(.text+0xeb4): In function `main':
  src/ngircd/ngircd.c:300: warning: strcat() is almost always misused,
                                    please use strlcat()

Thanks to Götz Hoffart for reporting this!
2013-10-07 21:56:09 +02:00