Commit Graph

1383 Commits

Author SHA1 Message Date
Alexander Barton 9a7499af8b Code cleanup of IRC_DISCONNECT(). 2009-09-30 16:00:05 +02:00
Alexander Barton bce16c2864 Code cleanup of IRC_SQUIT() in preparation to deal with bug #73. 2009-09-30 16:00:05 +02:00
Alexander Barton 926204cacd New local functions Check_Oper() and No_Privileges(). 2009-09-30 16:00:05 +02:00
Alexander Barton 3bf0c6f3b9 Bad_OperPass(): code cleanup. 2009-09-30 16:00:05 +02:00
Alexander Barton f78b0c61e9 New configuration option "AllowRemoteOper"
Added new configuration option "AllowRemoteOper" to control whether
remote IRC operators are allowed to use administrative commands that
affect this server or not

This commit introduces the configuration variable, but actually no
function is using it. That's up for the next patches to come ...
2009-09-30 16:00:04 +02:00
Florian Westphal fa09883c72 fix assertion failure in ng_ipaddr.c
when building with debugging enabled, but without ipv6 support,
ngircd dumped core when loading a config file that specified an ipv6
listen address.

ngircd: ng_ipaddr.c:45: ng_ipaddr_init: Assertion `sizeof(*addr) >=
res0->ai_addrlen' failed.
2009-09-26 11:12:47 +02:00
Florian Westphal affa03b277 configtest: complain when ssl keys are not readable 2009-09-20 23:22:28 +02:00
Alexander Barton 5b1efaee67 Check for sockaddr_in.sin_len and initialize it
Test for sockaddr_in.sin_len and initialize it to the correct value
which some systems (notably Mac OS X) require.

Note: this code path is only relevant when not using getaddrinfo().
2009-09-14 01:23:19 +02:00
Alexander Barton 536538968c Fix cb_connserver() to handle aborted outgoing connections
A configured server could have been removed while a connection apptempt
is still in progress. So the cb_connserver() callback has to test if the
server configuration record is still valid.
2009-09-12 00:17:42 +02:00
Florian Westphal 4daf780f01 conn.c: fix more sizeof(..dst_addr) misuse
the wrong sizeof() usage fixed in
d76910ce7b
(conn.c: fix resolver server address backlog) was a bit more
widespread, fix all others, too.
2009-09-11 23:31:46 +02:00
Florian Westphal ed72bf4ceb resolve.c: fix valgrind 'uninitialized memory' warning
fix the following warning generated by valgrind if ipv6 is enabled:

Syscall param write(buf) points to uninitialised byte(s)
   at 0x4000982: (within /lib/ld-2.9.so)
   by 0x80681A8: Resolve_Name (resolve.c:477)
   by 0x805439F: Conn_Handler (conn.c:1658)
   by 0x804AA7C: main (ngircd.c:331)

The warning is because ng_ipaddr_t can be a union, and only the
necessary parts are initialised.  The callers know what part
of the union is valid, so this is not a bug.
2009-09-11 23:09:11 +02:00
Florian Westphal d76910ce7b conn.c: fix resolver server address backlog
if more than one ip address is returned for a single host
name, ngircd is supposed to try other addresses in case
connect() to the first address returned fails for some
reason.

Alexander Barton noticed that this did not work at all,
as the additional results were not stored.
2009-09-11 22:55:32 +02:00
Alexander Barton 8fd0e29d46 Fix "implicit conversion shortens 64-bit value" warning
This patch fixes the following gcc warning in our sources:
"implicit conversion shortens 64-bit value into a 32-bit value"
2009-09-11 22:52:12 +02:00
Alexander Barton 66c6458ae7 Channel_Mode(): fix return code of function
Fix error handling of Channel_Mode() to return the correct connection
status ("connected"/"disconnected") insted of always returning success.
2009-09-11 00:48:07 +02:00
Alexander Barton 3b37ad334b IRC_SERVER(): code cleanup, remove unneeded variable 2009-09-11 00:41:12 +02:00
Alexander Barton c191ea53a9 IRC_PASS(): remove unnecessary variable initialization 2009-09-10 11:50:43 +02:00
Alexander Barton e1598e2670 Conn_Close(): remove unused variable "txt" 2009-09-10 11:49:39 +02:00
Florian Westphal cf7e19193b do not add default listening port if ssl ports were specified
Cosmo Kastemaa reported that its impossible to create an ssl-only setup,
as ngircd binds to port 6667 by default, even if setting "Ports =".

Only add the default port if _both_ "Ports" and "SSLPorts" are
unspecified.

Fixes bugzilla #98.
2009-08-31 22:08:35 +02:00
Alexander Barton 805bf03490 Client_CheckID(): fix connection information
This patch fixes the following silly log messages:
'ID "XXX" already registered (on connection -1)!'

If the ID is already registered on a local connection, the local
connection ID is printed; and if the ID is connected via a remote
server, "via network" is displayed.
2009-07-17 16:16:04 +02:00
Alexander Barton 63cbc6cd42 Fix return code of Conf_EnableServer()
Conf_EnableServer() only reports success if all required variables,
including host name and port, are set for the specific server.
2009-07-17 14:55:30 +02:00
Florian Westphal 0ef94edad7 add section and rfc number to comment about QUIT error 2009-06-05 01:39:33 +02:00
Florian Westphal 643ae1b48b enforce upper limit on maximum number of handled commands
reported on #ngircd: pasting lots of lines into a channel can kill off
many people on the channel if the read buffer is drained quickly enough
and the client-side TCP can't keep up with the incoming data.

This implements a throttling scheme:
- an irc client may send up to 3 commands per second before a one second
pause is enforced.
- an irc client may send up to 256 bytes per second before a one second
pause is enforced.

After discussion with Alexander Barton, server <-> server links are
treated specially: There is no artificial limit on the number of bytes
sent per second, and up to 10 commands are processed per second before
a pause is enforced.

It may be neccessary to make those limits tuneable to accomondate larger
networks, but for now they are compile time values.
2009-05-25 22:25:18 +02:00
Florian Westphal 9b1c47220f conn.c: fix NumConnections imbalance
New_Server() can call Conn_Close() in its error paths,
but that function decrements the number of current active
connections. Thus we need to increment it earlier.
2009-05-17 21:32:53 +02:00
Florian Westphal 8e2c5816ee SSL/TLS: fix error handling when ssl ctx init for outgoing server link fails 2009-05-17 21:27:27 +02:00
Florian Westphal f31c3a3aa2 SSL/TLS: fix error path in gnutls ssl ctx allocation 2009-05-17 21:18:04 +02:00
Florian Westphal 5196e9bcb1 SSL/TLS: remove redundant asserts/ifdefs 2009-05-16 20:48:43 +02:00
Florian Westphal 57aa64e117 SSL/TLS: proper indentation, remove erroneous comment 2009-05-14 00:00:55 +02:00
Alexander Barton fd7e85b798 Update copyright notice, it's 2009 already! 2009-05-05 17:08:48 +02:00
Florian Westphal 627b0b713c security: fix remotely triggerable crash in SSL/TLS code
When a server is running with SSL/TLS support compiled in,
it is trivial to crash the server by sending an MOTD request
via another server in the network.

- ONLY servers without ssl/tls support compiled in are not affected.
  Disabling SSL in the configuration (no ssl listening ports, etc)
  does NOT help.
- servers that are running standalone (i.e., not connected to any
  other servers) are not affected, either.

This affects all ngircd releases since ngircd 13 (earlier versions
have no SSL/TLS support).
2009-05-05 10:21:20 +02:00
Tassilo Schweyer 37359799eb Fix server list announcement
When ngircd announces the list of currently known servers
to a new (connecting) server, it sent the introducer of
the servers instead of the top server.

Assuming this network:

irc1.example.com
|--irc2.example.com
|    `--irc3.example.com
|         `--irc4.example.com
`--irc5.example.com

When irc4 connects to irc3, irc3 tells irc4 that irc5 was
connected to irc2. (irc2 had introduced irc5 to irc3; but thats
not what ngircd should have sent to the new server).

This also placed users on the wrong servers.
2009-04-26 00:30:49 +02:00
David Kingston 9b59f043c8 allow ping timeout quit messages to show the timeout value 2009-04-23 21:39:45 +02:00
Florian Westphal b545d38ae4 irc-server: do not remove hostnames from info text
that code does not really make sense -- the info
text is freely cofngiureable and des not follow a specific
format.

Also, that "+2" might have caused invalid memory accesses.
2009-04-22 23:15:17 +02:00
Florian Westphal 84eaed6c9a conn-zip: fix error handling
callers of (Un)Zip_Buffer() assume that
the function closes the connection on error.

However, this was not always the case.
2009-04-21 21:00:43 +02:00
Florian Westphal 544b9884f4 remove or translate old comments 2009-04-21 20:58:30 +02:00
Florian Westphal 5e16b6df2d client.c: remove unecessary comments 2009-04-21 20:58:28 +02:00
Florian Westphal ea041b8838 add const qualifier to pointers where possible 2009-04-21 20:58:23 +02:00
Alexander Barton 54879b432b Display IPv6 addresses as "[<addr>]" when accepting connections.
With this patch ngIRCd displays IPv6 addresses as "[<addr>]:<port>" when
accepting new connections and later, if no successful DNS lookup could
be made (or DNS is disabled altogether).
2009-04-10 13:22:03 +02:00
Dana Dahlstrom 3a7d59c1ac misspelling in ERR_NORECIPIENT reply 2009-03-25 20:44:40 +01:00
Florian Westphal ea35ba74b6 testsuite: add more predefined channels to server config
make sure it creates & and +, and accepts channel names without
a special character (ngircd should treat
'Name = chan' as 'Name = #chan').
2009-03-07 00:30:11 +01:00
Florian Westphal 2d4361d088 allow creation of persistent modeless channels 2009-03-07 00:21:43 +01:00
Florian Westphal e9e7fc33f1 add and use Channel_IsModeless()
avoid "name[0] == '+'" where possible, having Channel_IsModeless()
makes things much more obvious.
2009-03-07 00:13:25 +01:00
Alexander Barton c09742c518 Enhance INFO command to report compile time, if available 2009-03-05 16:04:36 +01:00
Alexander Barton 0a9608a26f Channel mode changes: break on error
Don't echo multiple syntax error messages (461) on invalid commands,
but break after the first one.
In addition, this solves corrupted 'Unknown mode "+' messages.
2009-03-03 16:33:40 +01:00
Alexander Barton dee89c2355 Channel_Mode(): code cleanup (no functional changes) 2009-03-03 15:06:34 +01:00
Florian Westphal b8c6dd503f TLS/SSL: remove useless error message when ssl connection is closed
When using OpenSSL, the following annoying "error" message was logged whenever
an encrypted connection was shut down in a orderly fashion:
TLS/SSL Connection shutdown: ConnSSL_Read: Unable to determine error

of course, this isn't an error at all.
2009-02-05 23:47:28 +01:00
Florian Westphal 2fce4667a8 SSL/TLS: clear all ssl realted flags on shutdown
one ssl related flags was not cleared on ssl shutdown.
introduce and use CONN_SSL_FLAGS_ALL to zap them all.
2009-02-04 23:23:12 +01:00
Florian Westphal c6a43fbaf0 TLS/SSL: fix memory leak when using compressed server links with ssl
commit 6bc2d3d06e
(New connection option CONN_RFC1459) forgot to adjust the ssl bitmasks.

The result is that when a compressed AND encrypted server link goes down
the memory allocated by zlib and the r/w buffers are no longer
free'd as the previous ConnSSL_Free() would then also remove the CONN_ZIP flag
from the flag mask.
2009-02-04 23:01:53 +01:00
Alexander Barton 3be9c477be Fix spelling of log message: "channek" vs. "channel" ... 2009-01-20 17:20:30 +01:00
Alexander Barton d09094812f Channel key file: store file name and open on each access.
Store the file name of channel key files and reopen them on each access
(on each JOIN command) insted of just storing the file handles.

This eliminates the special requirements (no delete) and makes sure
that always the actual file contents are used in all circumstances.
2009-01-20 17:20:30 +01:00
Alexander Barton c5000694d1 Support individual channel keys for pre-defined channels.
This patch introduces the new configuration variable "KeyFile" for
[Channel] sections in ngircd.conf. Here a file can be configured for each
pre-defined channel which contains individual channel keys for different
users. This file is line-based and must have the following syntax:

  <user>:<nick>:<key>

<user> and <nick> can contain the wildcard character "*".

Please not that these channel keys are only in effect, when the channel
has a regular key set using channel mode "k"!
2009-01-20 17:20:30 +01:00