Commit Graph

1179 Commits

Author SHA1 Message Date
Alexander Barton 6356418ae5 Change Introduce_Client() to set the correct client type (user/service). 2008-09-23 11:53:16 +02:00
Alexander Barton 28e9888764 Convert SQUERY to PRIVMSG on RFC 1459 compliant links. 2008-09-23 11:53:16 +02:00
Alexander Barton 3afa0e0658 Don't allow SQUERY to send to "target masks" and channels; only services! 2008-09-23 11:53:16 +02:00
Alexander Barton 3913de3cff Fix PRIVMSG/NOTICE handler (II): keep command when forwarding to channels.
- new function ngt_UpperStr().
- change Channel_Write() to take command name and error flag.
- remove now unneeded function Channel_Notice().
2008-09-23 11:53:15 +02:00
Alexander Barton 71e9ac486f Fix PRIVMSG/NOTICE handler Send_Message(): don't forward NOTICE as PRIVMSG. 2008-09-23 11:53:15 +02:00
Alexander Barton d93030ad27 Make real use of the CLIENT_SERVICE client type.
This patch enables ngIRCd to handle IRC services as real services, and not
as "fake users":

  - Set correct client type CLIENT_SERVICE for services,
  - Change log messages to include correct client type,
  - PRIVMSG: allow users to send messages to services,
  - Send services nick names to other servers (as users).

Please note that this patch doesn't announce services as services in the
network, but as regular users (as before). Only the local server knows
of services as services (see LUSERS command, for example). It is up to
one of the next patches to fix this and to introduce the SERVICE command
in server to server communication.

The propagation of services as regular users between servers doesn't limit
the functionality of the IRC services and will be the fallback for servers
that don't support "real" services propagation in the future.
2008-09-23 11:53:15 +02:00
Alexander Barton 4e125fb67c Allow IRC services to change their nick names. 2008-09-23 11:53:15 +02:00
Alexander Barton 33f32dbd67 New function Client_TypeText() and Destroy_UserOrService().
Client_TypeText() is used to get correct naming ("Client", "Service", ...)
for log messages, and Destroy_UserOrService() is used to correctly destroy
user and services clients.
2008-09-23 11:53:15 +02:00
Alexander Barton 74aac88dbf Send_Message(): really enforce target client type. 2008-09-23 11:53:14 +02:00
Alexander Barton 02d7623074 Allow ngIRCd to detect services connected to an "virtual services server".
Introduce a new configuration variable "ServiceMask" in SERVER blocks to
define a mask matching nick names that should be treated as services.
Regular servers don't need this parameter (leave it empty, the default),
but you should set it to "*Serv" when connection ircservices, for example.

This patch allows ngIRCd to detect services, it doesn't change the
functionality: you only get different log messages ;-)
2008-09-23 11:51:16 +02:00
Alexander Barton c5342fb467 Centralize logging functions in Introduce_Client(). 2008-09-23 11:47:17 +02:00
Alexander Barton 557be8c56b Get rid of INTRO_INFO structure again: we don't need it at all!
All the required information is already stored in the CLIENT structure
of new new connection, so pass this to Introduce_Client() and don't
invent an unneeded new structure ...
2008-09-23 11:47:17 +02:00
Alexander Barton 687784d276 Announce_User(): support RFC 1459 compatibility mode. 2008-09-23 11:47:17 +02:00
Alexander Barton 92603f7c80 Introduce_Client(): send MODES in RFC 1459 mode, too. 2008-09-23 11:47:17 +02:00
Alexander Barton d070ec08ab numeric.c: whitespace fixes ... 2008-09-23 11:47:17 +02:00
Alexander Barton a60465be3e Server links: detect RFC 1459 mode direct after SERVER command
This patch allows ngIRCd to detect right after receiving the SERVER command
from the peer whether the RFC 1459 compatibility mode must be used or not.
And it fixes the announcement of users during establishing new server links
with such peers.
2008-09-23 11:47:17 +02:00
Alexander Barton 14048c4717 Send and handle NICK+USER commands for user registration (RFC 1459).
This patch enables ngIRCd to deal with NICK and USER commands following
RFC 1459 to register new clients, and to send these commands instead of one
full NICK command as specified in RFC 2813 on connections that are in RFC
1459 compatibility mode.

Can be useful for e. g. IRC services that simulate a RFC 1459 server.
2008-09-23 11:47:17 +02:00
Alexander Barton f199d63724 New function IRC_WriteStrServersPrefixFlag_CB() using a callback function. 2008-09-23 11:47:17 +02:00
Alexander Barton 4f759d8113 New function Introduce_Client() to announce new local and remote users. 2008-09-23 11:47:17 +02:00
Alexander Barton 6bc2d3d06e New connection option CONN_RFC1459.
This new connection option CONN_RFC1459 indicates that the peer on this
link only supports the IRC protocol as defined in RFC 1459 and that the
compatibility mode (e. g. for outgoing commands like NICK) should be used.
2008-09-23 11:47:17 +02:00
Alexander Barton a5735f68d7 New global function Conn_SetOption(). 2008-09-23 11:47:16 +02:00
Alexander Barton 13f1d57e84 USER: servers and services can alter user information after registration.
This is required to do RFC 1459 style user registration on server links,
and is used by some services packages, too. See RFC 1459 section 4.1.3.
2008-09-23 11:47:16 +02:00
Alexander Barton 068d43352d NICK: allow servers and services to use RFC 1459 syntax (2 parameters).
This patch allows servers and services to call the NICK command using the
syntax defined in RFC 1459 to register new users, with only two parameters.
See section 4.1.2.

Useful for some services packages, which emulate this protocol.
2008-09-23 11:47:16 +02:00
Alexander Barton e56bd8ff89 Whitespace fixes: remove trailing tabulator characters. 2008-09-23 11:47:16 +02:00
Florian Westphal 2fce881d96 conn-ssl.c: don't append a newline to ConnSSL_GetCipherInfo 2008-09-15 12:25:54 +02:00
Florian Westphal ef3327d372 TLS/SSL support: code changes.
This adds the required code to enable ssl/tls support
during compile and run time, respectively.
2008-09-13 15:10:32 +02:00
Florian Westphal bdd44eb0ab TLS/SSL support: core files.
Contains support for both OpenSSL and GNU TLS.
Certificate Authentification is not yet supported.
2008-09-13 15:08:11 +02:00
Florian Westphal c997e04325 Fix handling of MaxConnections option
Config option claimed to be 'number of connections' but in reality this
was treated as 'largest file descriptor allowed'.

This also fixes another bug in New_connection, where the
ng_ipaddr_tostr_r error path was missing a return statement.
2008-08-30 15:37:19 +02:00
Alexander Barton 2c2c93e311 Include "mcheck.h" when using mtrace(). 2008-08-18 23:27:56 +02:00
Alexander Barton 41a23d20e4 SECURITY: Fixed a message handling bug which could crash the daemon.
Some message targets could lead to a NULL pointer dereference and therefore
could crash the daemon (denial of service).
(cherry picked from commit e493ad2d30ff80bca2556cde2212e367cb006517)
2008-08-17 17:37:36 +02:00
Alexander Barton c769cbecb6 Enable GNU libc "memory tracing" when compiled with debug code.
This patch lets ngIRCd activate "memory tracing" of the GNU libc when
compiled with debug code (configure: --enable-debug) and the functionality
is available on the system.
(http://www.gnu.org/software/libc/manual/html_node/Allocation-Debugging.html)
2008-08-13 16:00:57 +02:00
Alexander Barton dfc3de131c Make ngIRCd compile and run on NeXTSTEP 3.3 and OPENSTEP 4.2
by Steven D. Blackford <kb7sqi@aol.com>:

"I wanted to let you know that I've done a quick port of ngircd-0.12.0 for
NEXTSTEP3.3/OPENSTEP4.2. There wasn't a lot of changes required to get it
to compile clean, but I did make the necessary changes so that I didn't
have to use -posix flag. The NeXT has a pretty buggy POSIX implementation
so I always try to work around it. :-)
Anway, here's the changes required to get it to compile."
2008-08-01 16:21:16 +02:00
Alexander Barton e5cf73b9ee Fix Validate_Args(): unused parameter "Idx" and "Req"
This patch fixes the following error message of GCC (tested with version
4.3.0) when not compiling ngIRCd in "strict RFC" mode:

parse.c: In function "Validate_Args":
parse.c:341: error: unused parameter "Idx"
parse.c:341: error: unused parameter "Req"
2008-07-27 20:35:01 +02:00
Alexander Barton e5174c629c Fix Send_Message(): "lastCurrentTarget" may be used uninitialized
This patch fixes the following warning of GCC 4.3.1:

irc.c: In function "Send_Message":
irc.c:315: error: "lastCurrentTarget" may be used uninitialized in
this function
2008-07-27 17:16:41 +02:00
Alexander Barton 3358ad07d7 Fix t_diff(): declaration of 'div' shadows a global declaration
This patch fixes the following GCC warning message:
irc-info.c:422: warning: declaration of 'div' shadows a global declaration
2008-07-27 15:58:06 +02:00
Alexander Barton 318c8b238b Cosmetic whitespace and line length fixes, mostly in Send_Message(). 2008-07-27 15:50:51 +02:00
Brandon Beresini d4eb55c79f Cleaned up PRIVMSG and NOTICE patches. 2008-07-27 01:23:20 +02:00
Brandon Beresini 2546a13ad2 Cumulative Message Patch 2008-07-27 01:23:04 +02:00
Alexander Barton b92a7627f3 Don't allow empty channel names ("#") in strict RFC mode.
This closes Bug #88.

Patch proposed by Eric <egrunow@ucsd.edu>, but with wrong length
comparision: please note that Channel_IsValidName() checks the name
INCLUDING the prefix, so the test must be length<=1!
2008-07-22 13:24:14 +02:00
Alexander Barton 258143897c Return 461 (syntax error) on "JOIN :" and "PART :"
Up to this patch ngIRCd did not return any result (GIT master) or a badly
formated 403 (":irc.server 403 test  :No such channel" [note the two
spaces!], branch-0-12-x) on the above commands, this patch changes the
behaviour to reflect ircd 2.11 which returns 461 in both cases.
2008-07-22 13:18:19 +02:00
Alexander Barton 477f2fd9e7 Channel_Join(): Code cleanup. 2008-07-22 13:07:57 +02:00
Eric Grunow 71562ebe57 Translated comments from German to English 2008-06-16 13:58:56 +02:00
Alexander Barton 258e39e89f Fix GCC warnings for possibly uninitialized variables in IRC_JOIN
This patch fixes the following two warnings of GCC 4.2.4:

irc-channel.c: In function "IRC_JOIN":
irc-channel.c:185:
 warning: "lastkey" may be used uninitialized in this function
irc-channel.c:185:
 warning: "lastchan" may be used uninitialized in this function
2008-06-16 13:18:03 +02:00
Alexander Barton a84f7dcee5 Allow mixed line terminations (CR+LF/CR/LF) in non-RFC-compliant mode
Up to now ngIRCd accepted CR+LF as well as a single CR or LF in "non RFC
compliant" mode (the default). But ngIRCd became confused when it received
data containing mixed line endings (e. g. "111\r222\n333\r\n").

This patch enables ngIRCd (in "non RFC compliant" mode) to detect CR+LF,
CR, and LF as equally good line termination sequences and to always end the
command after the first one detected.

Some clients (for exmaple Trilian) are that ... broken to send such mixed
line terminations ...

First patch proposed by Scott Perry <scperry@ucsd.edu>,
Thanks to Ali Shemiran <ashemira@ucsd.edu> for testing!
2008-06-11 16:00:38 +02:00
Alexander Barton 8644cbf197 Don't allow stray \r or \n in command parameters
If ngircd receives an input line like "COMMAND arg\nIRRELEVANT\r\n",
"arg\nIRRELEVANT" is passed as an argument to COMMAND. This can lead
to output like:

:ngircd.test.server 322 nick #chan 1 :
topicwithprecedingnewline
:ngircd.test.server 322 nick #nxtchan 1 :
[..]

Worse, this allows clients to piggyback irc commands, e.g.
"TOPIC #a :test\n:fake!~a@nonexistant JOIN :#a\r\n", which
causes the client to receive a JOIN command during /LIST output.

Bug reported by Scott Perry, first patch by Florian Westphal.
2008-05-30 14:58:25 +02:00
Alexander Barton 6f7b669bec --configtest: return non-zero exit code if there are errors 2008-05-28 00:31:20 +02:00
Alexander Barton 951314cb79 Handle_Buffer(): code cleanup.
Both callers ignore the return code of this function, so get rid of it,
but make sure that the client is disconnected on errors.
2008-05-26 23:38:32 +02:00
Alexander Barton d360871394 Conn_Handler(): cleanup code, add/translate comments.
In addition, the "timeout" variable has been removed because it is
unnecessary today: Handle_Buffer() handles all the data it can handle,
and io_dispatch() returns immediately when new data is available. So
we don't have to double-check but better sleep. Pointed out by Florian.
2008-05-26 21:38:27 +02:00
Scott Perry b90f71ca2a Use strtok_r instead of strchr in IRC_JOIN.
This patch does significant cleanup on the join code by using strtok_r
instead of mangling strchr to parse channel names and keys in parallel when
a JOIN command contains a list of channels and keys.

Also adds an strtok_r implementation to libportab.
2008-05-26 21:20:03 +02:00
Alexander Barton 956bbe2c28 Reset client idle time on NICK, JOIN, and PART 2008-05-24 21:50:54 +02:00