Commit Graph

145 Commits

Author SHA1 Message Date
Alexander Barton 2a7dd06ebd Code cleanup: mostly removing empty lines 2011-02-13 17:52:38 +01:00
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
Florian Westphal cac9f279fa send RFC compliant netsplit messages. 2005-06-04 12:32:09 +00:00
Alexander Barton 95f8b963a6 Reformatted and documented code of the first part of the IRC_NICK()
function; and register WHOWAS entries on nickname changes, too.
2005-05-17 23:24:43 +00:00
Alexander Barton f56a1bdf20 Use tabulator, not 8 spaces ... 2005-03-21 22:22:09 +00:00
Florian Westphal 8adff59223 Remove INT, LONG, BOOLEAN, STATIC, CONST, CHAR datatypes.
use stdbool.h / inttypes.h if available.
2005-03-19 18:43:48 +00:00
Alexander Barton cb76d96efb Fixed some warnings of non-gcc-compilers (e. g. original Apple compiler on
A/UX): "warning: illegal pointer combination, op =".
2004-03-11 22:16:31 +00:00
Alexander Barton 6667bb6b77 The info text ("real name") of users is set to "-" if none has been
specified using the USER command (e. g. "USER user * * :"). Reason:
the original ircd doesn't like empty ones and would KILL such users.
2004-02-04 19:56:04 +00:00
Alexander Barton 57c7e23622 Added #include for strings.h to fix compiler warnings. 2004-01-17 03:17:49 +00:00
Alexander Barton b79b315dd4 Added optional support for IDENT lookups (configure switch "--with-ident"). 2003-12-27 13:01:12 +00:00
Alexander Barton 05e2c0f048 Extended version reporting of CVS builds. 2003-12-04 14:05:16 +00:00
Alexander Barton 7b6e26628a Fixed and enhanced penalty handling; changed internal time resoluiton of
the server to one second. Code cleanup.
2003-11-05 23:24:48 +00:00
Alexander Barton 62796722f1 Changed all PACKAGE's to PACKAGE_NAME and all VERSION's to PACKAGE_VERSION. 2003-03-31 15:54:21 +00:00
Alexander Barton ff98833136 - Kill_Nick() uses an "faked internal KILL" now. 2003-01-08 22:28:12 +00:00
Alexander Barton c428ac7563 - Renamed RPL_FEATURE_MSG to RPL_ISUPPORT_MSG. 2003-01-02 17:55:28 +00:00
Alexander Barton ae6a7e7c0b - Fixed up command forwarding: only to servers! 2003-01-01 13:29:40 +00:00
Alexander Barton b8d7dcec77 - Adjusted includes for new "conn-func.h" header. 2002-12-30 17:15:42 +00:00
Alexander Barton a2544e496c - Cleaned up handling of server configuration structures. 2002-12-30 00:01:42 +00:00
Alexander Barton a3f59f1a5b - new numeric on login: RPL_FEATURE 2002-12-22 23:31:21 +00:00
Alexander Barton 490f28ffd1 - new file header format (in english);
- new file ident semantics.
2002-12-12 12:24:18 +00:00
Alexander Barton 9f122037ae - Logging von doppelten ID's verbessert. 2002-12-03 18:56:33 +00:00
Alexander Barton 0c471b84f7 - neues Source-Modul "irc-info"; neuer Befehl STATS. 2002-11-30 17:39:56 +00:00
Alexander Barton 1e59617d2c - Parser auf Befehlstabelle umgestellt. 2002-11-30 15:04:57 +00:00
Alexander Barton 65f3adca21 - Unterstuetzung fuer komprimierte Server-Server-Links implementiert. 2002-11-26 23:07:24 +00:00
Alexander Barton 2b6dbb07e8 - in RPL_YOURHOST_MSG wurde ein fehlerhafter Versionsstring geliefert. 2002-09-22 21:40:33 +00:00
Alexander Barton 51dabeafaa - Server-Versionsausgabe ueberarbeitet. 2002-09-09 03:34:33 +00:00
Alexander Barton 55ee4c9553 - Das IRC+-Protokoll wird nun richtig erkannt ... 2002-09-03 20:58:43 +00:00
Alexander Barton ad1cbe34b4 - Anpassungen/Umstellung auf IRC+-Protokoll. 2002-09-03 20:39:54 +00:00
Alexander Barton 5aa9c8f44c - Flags von connecteten Servern werden nun gespeichert. 2002-09-03 18:55:03 +00:00
Alexander Barton c0910498e8 - Logmeldungen fuer Server- und Protokollversionen verbessert. 2002-09-02 19:31:26 +00:00
Alexander Barton c67bb2ac9f - Version (Server und Protokoll) von connectierten Servern wird nun ausgewertet. 2002-09-02 19:04:30 +00:00
Alexander Barton f7327524fc - Weitere Anpassungen an pre-ANSI-Compiler. 2002-05-30 16:52:20 +00:00
Alexander Barton c2f60abe55 - Anpassungen an pre-ANSI-Compiler,
- Includes aufgeraumt: Header includieren keine anderen mehr.
2002-05-27 13:09:26 +00:00
Alexander Barton 7f79591522 - IRC_QUIT(): der QUIT-Befehl wird nun auch von unreg. Clients akzeptiert. 2002-04-14 14:02:35 +00:00
Alexander Barton 5b4e9152ad - Format-String fuer Log-Meldung bei Nick-Aenderungen lokaler Clients
war corrupt, der Server stuerzte so in der Regel ab :-(
2002-04-08 16:37:50 +00:00
Alexander Barton bcc5138518 - Kommentar korrekt eingerueckt. Wow ;-) 2002-03-26 23:58:34 +00:00
Alexander Barton bc4ed22635 - alle Client_GetFromID() durch Client_Search() ersetzt. 2002-03-25 17:08:54 +00:00
Alexander Barton 69f683070a - Nick-Aenderungen: Log-Eintrag nur noch im Debug-Modus bzw. fuer lokale User. 2002-03-19 16:38:37 +00:00
Alexander Barton ca33cbda05 - externe portab-Header werden nicht mehr benoetigt/benutzt, dadurch
einige Aenderungen an diversen Source-Dateien und Headern.
- Dateien enthalten keine CVS-History mehr.
2002-03-12 14:37:51 +00:00
Alexander Barton f7a0ff1f65 - SQUIT, QUIT: Loglevel bei unbekannten Clients wieder auf WARNING erhoeht. 2002-03-11 22:06:32 +00:00
Alexander Barton 50ec7a56a4 - Client_Destroy() hat neuen Paramter: QUITs fuer Clients verschicken? 2002-03-11 22:04:10 +00:00
Alexander Barton 9fc7e66f66 - Log-Level von SQUIT und QUIT bei unbekannten Clients auf DEBUG herabgesetzt. 2002-03-11 17:33:40 +00:00
Alexander Barton 5fa05dcea8 - IRC_PING() ist, wenn nicht im "strict RFC"-Mode, toleranter und akzptiert
beliebig viele Parameter: z.B. BitchX sendet soetwas.
2002-03-10 22:40:22 +00:00
Alexander Barton 2ee05c9a68 - Source in weitere Module fuer IRC-Befehle aufgesplitted. 2002-03-03 17:15:11 +00:00
Alexander Barton 0370c4843f - Bei der USER-Registrierung wird NICK nicht mehr sofort geforwarded,
sondern erst dann, wenn auch ein gueltiges USER empfangen wurde.
2002-03-02 00:49:11 +00:00
Alexander Barton c23199d971 - Modul aus irc.c bzw. irc.h ausgegliedert. 2002-02-27 23:26:21 +00:00