commit - 39d630c00d5b4680642d52463284e3282c2303ac
commit + 78a3b4c7d64e87845d6babef9a4d1619f9691aba
blob - 383c4dee288f5a96e3c0ae0b88855ac49e3d9fb7
blob + 82e6a5aef0fb405d23b4bdc61f14174ffc39e9f3
--- src/ngircd/irc-mode.c
+++ src/ngircd/irc-mode.c
/**
+ * Check if the "mode limit" for a client has been reached.
+ *
+ * This limit doesn't apply for servers or services!
+ *
+ * @param Client The client to check.
+ * @param Count The number of modes already handled.
+ * @return true if the limit has been reached.
+ */
+static bool
+Mode_Limit_Reached(CLIENT *Client, int Count)
+{
+ if (Client_Type(Client) == CLIENT_SERVER
+ || Client_Type(Client) == CLIENT_SERVICE)
+ return false;
+ if (Count < MAX_HNDL_MODES_ARG)
+ return false;
+ return true;
+}
+
+
+/**
* Handle client mode requests
*
* @param Client The client from which this command has been received.
Client_ID(Origin), Channel_Name(Channel));
break;
case 'k': /* Channel key */
- if (mode_arg_count++ >= MAX_HNDL_MODES_ARG)
+ if (Mode_Limit_Reached(Client, mode_arg_count++))
goto chan_exit;
if (!set) {
if (modeok)
}
break;
case 'l': /* Member limit */
- if (mode_arg_count++ >= MAX_HNDL_MODES_ARG)
+ if (Mode_Limit_Reached(Client, mode_arg_count++))
goto chan_exit;
if (!set) {
if (modeok)
/* --- Channel lists --- */
case 'I': /* Invite lists */
case 'b': /* Ban lists */
- if (mode_arg_count++ >= MAX_HNDL_MODES_ARG)
+ if (Mode_Limit_Reached(Client, mode_arg_count++))
goto chan_exit;
if (arg_arg > mode_arg) {
/* modify list */