Commit Graph

94 Commits

Author SHA1 Message Date
Alexander Barton 03628dbeaf Add Doxygen @file documentation to each source and header file 2011-02-13 17:52:38 +01:00
Alexander Barton 8700f4d93c Better check for invalid IRC+ PASS command
Don't do a NULL-pointer dereference when a remote server using the
IRC+ protocol sends an invalid PASS command without the required
<serverversion> parameter ...
2011-01-23 18:38:36 +01:00
Alexander Barton d3ef2239e1 Add connection/socket information to some log messages 2011-01-16 23:24:41 +01:00
Florian Westphal 1dca082fc6 config: deprecate NoXX-Options
ngircd unfortunately uses several options using double-negation, e.g.

NoIdent = No, NoPam = No, etc.

This renames all options by dropping the "No" prefix, e.g.
"NoIdent = no" becomes "Ident = yes".

The old options will continue to work, but will cause a warning
message.

Also update man pages and default config.

To prevent silly
'Ident = yes' from appearing in  --configtest output in the
'ident support not compiled in and Ident Option not used' case,
make default value depend on feature availability.
If feature is available, enable by default, otherwise disable.

We might consider moving these options to a new
[Feature]

section, or something like that, because none of these options are
essential.

Another possible improvement:

'Ident = yes' option in ngircd.conf causes a warning if ngircd was
built without ident support.

This does not happen with e.g. zeroconf....
2011-01-09 13:59:33 +01:00
Alexander Barton 6ebb31ab35 Remove Proc_Kill(), use timeout to kill child processes
This avoids a race and potentionally killing the wrong process on
systems that use randomized process IDs; now the child itself is
responsible to exit in a timely manner using SIGALRM.
2010-07-14 10:29:05 +02:00
Alexander Barton 560492a4a4 Authenticated users should be registered without the "~" mark 2010-07-13 23:18:54 +02:00
Alexander Barton 9cd3494de9 Don't Proc_Kill() childs after Proc_Read(): done there already. 2010-07-13 22:29:06 +02:00
Alexander Barton 6131822af6 Don't even fork a PAM-subprocess if "NoPAM" option is set 2010-07-13 22:14:53 +02:00
Alexander Barton 57a2faf4a7 Use Proc_GenericSignalHandler() as handler for SIGTERM by default 2010-07-13 22:04:35 +02:00
Alexander Barton f369177617 New configuration option "NoPAM" to disable PAM
When the "NoPAM" configuration option is set and ngIRCd is compiled
with support for PAM, ngIRCd will not call any PAM functions: all
connection attemps without password will succeed instead and all
connection attemps with password will fail.

If ngIRCd is compiled without PAM support, this option is a dummy
option and nothing changes: the global server password will still be
in effect.
2010-07-13 16:47:01 +02:00
Alexander Barton 28424d013d Make sure signal.h is #include'd when needed 2010-07-12 13:22:19 +02:00
Alexander Barton 808d4f6e85 Implement asynchronous user authentication using PAM
For each client connection a child process is forked which handles the
actual PAM authentication and reports the result back to the master
process using a pipe for communication.

While the PAM authentication is in process the daemon does not block.
2010-07-12 12:56:33 +02:00
Alexander Barton 1995af0ed6 New functions Client_[Set]OrigUser() to get/set user specified by peer
The Client_SetOrigUser() function is used to store the peer-provided
user name (see USER command) in its original form, not changed by
IDENT results, for example.
2010-07-11 17:03:43 +02:00
Alexander Barton 5462c6c50f Don't #include client.h when conn.h/conn-func.h is already included
conn.h and cinn-func.h both already #include client.h, so it is
not needed to do it twice.
2010-06-30 23:49:52 +02:00
Alexander Barton cc336b7558 Only #include resolve.h if it is really needed 2010-06-29 22:55:27 +02:00
Alexander Barton f76e0a1db6 Implement user mode "c": receive connect/disconnect NOTICEs
Users having the user mode "c" set receive NOTICE messages on each
new client connection to the local server as well as disconnects.
Only IRC operators (users having the mode "o" set) are allowed to
set the 'c' user mode.

These connect/disconnect messages can be useful for open proxy
scanners -- BOPM (http://wiki.blitzed.org/BOPM) is now functional
with ngIRCd, for example.
2010-06-25 00:33:01 +02:00
Florian Westphal 6dc80bd195 fix "beeing" typo
reported by Fabio Scotoni via bugzilla #101.
2010-05-14 19:43:08 +02:00
Alexander Barton 6e8cf51bb2 Implement WEBIRC command
The WEBIRC command is used by some Web-to-IRC gateways to set the correct
user name and host name of users instead of their own.

Syntax: WEBIRC <password> <username> <hostname> <ip-address>

The <password> must be set using the new configuration variable "WebircPassword" in the [Global] section of ngircd.conf.

Please note that the <ip-address> is currently not used by ngIRCd (we don't store it in the CLIENT structure, only the resolved hostname).
2010-02-11 00:01:53 +01:00
Alexander Barton c191ea53a9 IRC_PASS(): remove unnecessary variable initialization 2009-09-10 11:50:43 +02:00
Florian Westphal 544b9884f4 remove or translate old comments 2009-04-21 20:58:30 +02:00
Florian Westphal 1c7b9dbe93 remove unneeded LOG_DEBUG when not compiling with DEBUG support
when ngircd is build without DEBUG enabled, LOG_DEBUG messages
are always discarded.

To avoid the extra code, ngircd has a LogDebug() wrapper which
gets removed by the compiler when compiling without DEBUG defined.

Update a few functings which were using the
Log(LOG_DEBUG, .. interface directly without #ifdef DEBUG guards.

   text	   data	    bss	    dec	    hex	filename
 127748	   1900	  28280	 157928	  268e8	ngircd.before
 126836	   1896	  28280	 157012	  26554	ngircd.after
2009-01-10 00:54:07 +01:00
Alexander Barton 178f9cbdac Announce IRC services in the network.
This patch
 - introduces a new server flag "S" to indicate that the server can handle
   the SERVICE command (on server links),
 - implements the IRC command "SERVICE" for server-server links,
 - uses the "SERVICE" command to announce IRC services when a new
   server connects to it,
 - and fixes the Send_Message() function to let it send messages to
   services using a "target mask".

If the remote server doesn't indicate that it can handle the "SERVICE"
command (it has not set the "S" flag), services are announced as regular
users as before.
2008-09-23 11:53:16 +02:00
Alexander Barton 6356418ae5 Change Introduce_Client() to set the correct client type (user/service). 2008-09-23 11:53:16 +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 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 92603f7c80 Introduce_Client(): send MODES in RFC 1459 mode, too. 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 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 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
Alexander Barton 956bbe2c28 Reset client idle time on NICK, JOIN, and PART 2008-05-24 21:50:54 +02:00
Alexander Barton 4e56e5341f Implement IRC commands SERVICE, SERVLIST, and SQUERY as dummy functions
SERVICE, SERVLIST, and SQUERY are required by RFC 2812 (it states in
section 3 that "all commands described in this section MUST be implemented
by any server for this protocol." -- So we implement them without (much)
actual functionality ...
2008-05-05 18:06:43 +02:00
Alexander Barton 33b1204349 Get rid of cvs-version.* and CVSDATE definition.
(cherry picked from commit b187fac244f4e14705f882ba7c43eef0238e2830)
2008-04-25 00:14:11 +02:00
Florian Westphal 42db159d26 Fix wrong strncpy usage if CVSDATE defined
Hello_User() used strncpy with overlapping src/dest.
Use memmove instead.
2008-02-26 23:49:33 +01:00
Alexander Barton 47ca178a21 Introduce option to configure the maximum nick name lenth in ngircd.conf
- New configuration option "MaxNickLength" to specify the allowed maximum
  length of user nick names. Note: must be unique in an IRC network!
- Enhanced the IRC+ protocol to support an enhanced "server handshake" and
  enable server to recognice numeric 005 (ISUPPORT) and 376 (ENDOFMOTD).
  See doc/Protocol.txt for details.
2007-11-21 12:16:33 +00:00
Alexander Barton ca5e09865e Removed an unused variable -- but where did it come from!? Strange ... 2006-10-03 10:28:38 +00:00
Alexander Barton 27d947fb7d Allow PASS syntax defined in RFC 1459 for server links, too.
Removed client status CLIENT_GOTPASSSERVER.
2006-10-01 19:05:00 +00:00
Alexander Barton bed98979dc Enhanced ISUPPORT message (numeric 005). 2006-10-01 19:03:05 +00:00
Florian Westphal 0eccdbc137 -whitespace damage 2006-08-12 11:56:24 +00:00
Alexander Barton a5b5a6a99a Make PONG handler compatible with ngIRCd <= 0.9 ("make it more relaxed"). 2005-09-01 10:51:24 +00:00
Alexander Barton 4074fd9149 Enhanced the handler for PING and PONG commands: fix forwarding and enable
back-passing of a client supplied additional argument of PING.
2005-08-28 11:40:13 +00:00
Florian Westphal 6434d0b23e return PING argument in PONG reply if STRICT_RFC is not defined. 2005-08-27 18:39:56 +00:00
Alexander Barton 77f54693ef Removed unnecessary #define of "LOCAL", now use plain C "static" instead. 2005-07-31 20:13:07 +00:00
Florian Westphal 84706af7fe topic no longer limited to 127 chars (now only limited by protocol) 2005-07-28 16:23:55 +00:00