Commit Graph

1712 Commits

Author SHA1 Message Date
Alexander Barton 4d0069c3a8 New RPL_WHOISREGNICK_MSG(307) numeric: indicate if nick is registered 2012-01-16 02:18:24 +01:00
Alexander Barton 12c60a670e IRC_WHOIS_SendReply(): Code cleanup 2012-01-16 02:15:41 +01:00
Alexander Barton 2f7d0c0839 Limit channel invite and ban lists to 50 entries
- New function Lists_Count().
 - New limit #define MAX_HNDL_CHANNEL_LISTS = 50.
 - New numeric #define ERR_LISTFULL_MSG(478).
 - Adjust numeric RPL_ISUPPORT2_MSG(005) accordingly ("MAXLIST")
2012-01-16 00:29:36 +01:00
Alexander Barton 1afbf71236 Make Send_ListChange() a little bit more generic 2012-01-16 00:15:26 +01:00
Alexander Barton 7ed08f01ef Remove unused prototype of Lists_AlreadyRegistered()
This prototype has been introduced by commit fa7bb279 in 2006,
but as far as I can see, this function never existed ...
2012-01-15 19:46:00 +01:00
Alexander Barton 81cc5f82b5 Channel lists: Fix duplicate check and error messages
- Check correct list for duplicates when adding items.
 - Don't generate any messages when adding duplicates or removing
   non-existing items (this is how ircd-seven and ircu behave).
 - Code cleanup: Add_Ban_Invite(), Del_Ban_Invite().
2012-01-15 19:11:03 +01:00
Alexander Barton 78a3b4c7d6 Don't enforce MAX_HNDL_MODES_ARG on server and service links 2012-01-15 14:33:04 +01:00
Alexander Barton d4d8102fc9 Don't stop join handling on faulty channel, skip it (part #2)
Commit 565523cb allowed processing of further channel names given to the
JOIN command when a single name was invalid.

After this patch, the JOIN command handler continues to process channel
name lists even after errors like "channel is full", "too many channels",
and the like and generates appropriate error messages for all the
channels given by the client.
2012-01-13 10:50:00 +01:00
Alexander Barton 77f68b4fd1 JOIN command: don't check channel limit if already member
Don't check the channel limit and don't report "too many channels"
when trying to join a channel that the client is already a member of.
2012-01-13 10:40:20 +01:00
Alexander Barton 2f8877ded4 Return ERR_UNKNOWNMODE(472) for unknown channel modes
The daemon reported ERR_UMODEUNKNOWNFLAG(501), which is wrong.
2012-01-09 23:18:39 +01:00
Alexander Barton 4bff3daf92 Numberic 005 (ISUPPORT), CHANMODES: add "O", "R", "z" modes 2012-01-09 12:34:55 +01:00
Alexander Barton c5beca8aab Limit list replies of LIST, WHO, WHOIS, and MAX_RPL_WHOWAS
Introduce new #define's MAX_RPL_LIST(100), MAX_RPL_WHO(25),
MAX_RPL_WHOIS(10), and MAX_RPL_WHOWAS(25).
2012-01-06 20:06:25 +01:00
Alexander Barton f8405b1a4f New function IRC_CheckListTooBig() to check size of list replies
It the limit is reached, a NOTICE is sent to the client and list
processing should stop.
2012-01-06 20:05:07 +01:00
Alexander Barton fdfc27265e LIST command: compare pattern case insensitive 2012-01-06 19:55:21 +01:00
Alexander Barton a4d1e6007f IRC_LIST(): Code cleanup 2012-01-06 19:54:23 +01:00
Alexander Barton 9260759cec DEFAULT_WHOWAS->DEF_RPL_WHOWAS; MAX_CMODES_ARG->MAX_HNDL_MODES_ARG
To streamline naming, in preparation for MAX_RPL_WHO and MAX_RPL_WHOWAS :-)
2012-01-06 18:57:31 +01:00
Alexander Barton c2ac1ad3ba defines.h: Code cleanup and (a little bit) more documentation 2012-01-06 18:25:10 +01:00
Alexander Barton 470d2e2362 RPL_ISUPPORT (numeric 005): Report MODES=<MAX_CMODES_ARG>
"Maximum number of channel modes with parameter allowed per MODE command."
See <http://www.irc.org/tech_docs/005.html> for details.
2012-01-06 17:46:52 +01:00
Alexander Barton 888664435a Channel modes: really break handling when MAX_CMODES_ARG is hit
This fixes 98493077.
2012-01-06 17:43:20 +01:00
Alexander Barton 98493077a2 channel modes: only handle MAX_CMODES_ARG modes with arguments
Limit the MODE command to handle a maximum of MAX_CMODES_ARG (5) channel
modes that require an argument (+Ibkl) per call.

Please note: Further modes that require arguments are silently ignored
and end the handling of any further modes.
This is similar to the behavior of ircd2.11 (silently ignores but seems
to handle other modes) as well as ircd-seven (silently ignores but handles
some(!) other modes) ...
2012-01-06 17:27:29 +01:00
Alexander Barton 1fa2af5b3a Fix handling of channel mode sequence with/without arguments
For example, don't generate wrong error messages when handling
"MODE #chan +IIIIItn *!aa@b *!bb@c *!cc@d *!dd@e *!ee@f".
2012-01-06 17:24:55 +01:00
Alexander Barton 05cc9bf9b0 Conn_Write(): Make sure there is a client when detecting its type
The assert(client != NULL) got triggered during our tests, so there is
an error path that resulted in the connection being still established
(sock >= 0) but the client structure already freed.

So Conn_Write() should handle it!
2012-01-06 03:26:24 +01:00
Alexander Barton cc06e1ff89 Proc_Close(): Only close socket if it is still valid
It could be invalid when calling Proc_Close() a 2nd time, for exmaple,
which could happen when we hit a timeout doing IDENT requests :-(
2012-01-06 02:26:04 +01:00
Alexander Barton 9fbf592924 WHOIS command: make sure matching is case-insensitive
And make sure that RPL_ENDOFWHOIS replies with the unmodified mask
like it has been received from the client.
2012-01-05 00:51:39 +01:00
Alexander Barton adf92302bf WHOIS command: don't anser queries for IRC servers
Thanks to Cahata for spotting this!
2012-01-05 00:24:46 +01:00
Alexander Barton 566a451299 WHOIS command: make sure the reply ends with RPL_ENDOFWHOIS
Up to now, each reply for itself ended in RPL_ENDOFWHOIS and queries
for unknown nick names lacked the RPL_ENDOFWHOIS -- both is wrong.
2012-01-05 00:22:57 +01:00
Alexander Barton 5e3449a241 LINKS command: support <mask> parameter
The <mask> can be used to limit the servers shown in the listing.
2012-01-04 22:51:02 +01:00
Alexander Barton 762b0325df IRC_LINKS(): Code cleanup; more documentation 2012-01-04 22:49:18 +01:00
Alexander Barton 6b62a5ec4f Add 1 second penalty for every further target on PRIVMSG/NOTICE
This reduces the possibility of flooding channels with commands like
"PRIVMSG/NOTICE #a,#n,#c,... :message" a little bit.

Problem noticed by Cahata -- thanks!
2012-01-04 21:46:58 +01:00
Alexander Barton b24d645ca1 Conn_SetPenalty(): Add new "penalty time" on each function call
Until now, the penalty time has only been set when longer as the
already set one, so it didn't accumulate.

And add documentation for and clean up code in Conn_SetPenalty() and
Conn_ResetPenalty() functions.
2012-01-04 21:39:46 +01:00
Alexander Barton 1bb2fbedcc Enhance log messages when setting user and group 2012-01-03 21:05:35 +01:00
Alexander Barton 3193d5477c NGIRCd_getNobodyID(): Code cleanup 2012-01-03 20:49:42 +01:00
Alexander Barton edab86e0f8 Display correct error message when "Server{UID|GID}" is invalid
This partly closes bug #118. ngIRCd still starts up even when
Server{UID|GID} is invalid: then the daemon falls back to "nobody"
when running with root(0) privileges (as before).
2012-01-03 20:37:41 +01:00
Alexander Barton e4006a93e3 NGIRCd_Init(): Code cleanup 2012-01-03 19:34:54 +01:00
Alexander Barton 9069380ddf main(): Code cleanup 2012-01-03 19:25:31 +01:00
Alexander Barton 5eb9f2e717 Update Copyright notices for 2012 2012-01-03 11:30:45 +01:00
Florian Westphal abfc5c6e27 lists: don't crash if reason ptr is NULL
commit 15fec92ed7
(Update list item, if it already exists) can make ngircd
crash because 'Reason' can be NULL, as reported by
Cahata on the ngircd mailing list.

Doesn't affect any released ngircd versions.

Also, make sure that we do not pass NULL as arguments
to a '%s' printf-like function.
2012-01-02 23:43:13 +01:00
Alexander Barton 565523cbb4 Don't stop join handling on faulty channel, skip it
When JOIN is received with more than one channel name, don't stop
processing on the first error (e.g. bad name, wrong channel key, ...)
but report an error and continue with the other given channel names.

Reported by Cahata -- thanks!
2012-01-02 15:23:17 +01:00
Alexander Barton 013298d4c6 IRC_JOIN(): Code cleanup 2012-01-02 15:22:52 +01:00
Alexander Barton af13732ec7 ISON command: reply with correct upper-/lowercase nick names
Reported by Cahata -- thanks!
2012-01-02 15:06:44 +01:00
Alexander Barton 408a74b865 IRC_ISON(): Code cleanup 2012-01-02 15:04:40 +01:00
Alexander Barton f47904bf95 Remove unused "bool have_arg" from IRC_WHO()
This fixes:

 irc-info.c: In function ‘IRC_WHO’:
 irc-info:936:18: warning: variable ‘have_arg’ set but not used
2012-01-02 00:56:31 +01:00
Alexander Barton 56b7e67307 New configuration option "PAMIsOptional"
When "PAMIsOptional" is set, clients not sending a password are still
allowed to connect: they won't become "identified" and keep the "~"
character prepended to their supplied user name.
2012-01-01 17:12:36 +01:00
Alexander Barton b681aa5b9f PAM: don't use global password buffer for conv struct
Use the pointer of the password of the client directly.
Eventually we can get rid of the global password again ...
2011-12-31 18:06:17 +01:00
Alexander Barton 1a5ed654b4 Fixed handling of WHO commands
This fixes two bugs:
 - "WHO <nick>" returned nothing at all if the user was "+i"
   (reported by Cahata, thanks).
 - "WHO <nick|nickmask>" returned channel names instead of "*"
   when the user was member of a (visible) channel.

Clean up code and add documentation as well.
2011-12-30 14:57:12 +01:00
Alexander Barton 9cbb8f3bb8 Remove unused "time_t now" from Lists_Check()
This fixes:

 lists.c: In function ‘Lists_Check’:
 lists.c:330:9: warning: variable ‘now’ set but not used
2011-12-30 01:03:59 +01:00
Alexander Barton e19ce437ca Fixed some spelling errors in documentation and code comments
Thanks to Christoph Biedl!
2011-12-30 00:50:27 +01:00
Alexander Barton 765c2f26ea Fixed typo in two error messages
Thanks to Christoph Biedl!
2011-12-30 00:32:11 +01:00
Alexander Barton 69fa6f268a LUSERS reply: only count "visible" channels
Rename Channel_Count() to Channel_CountVisible() and only count channels
that are visible to the requesting client, so the existence of secret
channels is no longer revealed by using LUSERS.

Reported by Cahata -- thanks!
2011-12-28 15:11:01 +01:00
Alexander Barton 43509fd22c IRC_Send_LUSERS(): Code cleanup 2011-12-28 14:52:21 +01:00