commit - 9f236c4b9155f3d4f1c7f1bf3b22e8a106e29df3
commit + fcf61e9e0264d081e72eedddbd4a45b619e82b01
blob - 0421d9170201b9d7d81f26d6b61feea4ee584c2d
blob + cab20c493bcb493f95bf3398528118a06f322874
--- src/ngircd/irc-channel.c
+++ src/ngircd/irc-channel.c
assert( Client != NULL );
assert( Req != NULL );
-
- IRC_SetPenalty(Client, 1);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
assert(Client != NULL);
assert(Req != NULL);
- IRC_SetPenalty(Client, 2);
-
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
if (Req->argc > 0)
blob - 79a157c24bf658fb91309ba65c566dff4ab9322a
blob + 202f427f967d8cfa3d8606a61765f80c8274b197
--- src/ngircd/irc-info.c
+++ src/ngircd/irc-info.c
assert( Client != NULL );
assert( Req != NULL );
-
- IRC_SetPenalty(Client, 1);
_IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix)
assert(Client != NULL);
assert(Req != NULL);
-
- IRC_SetPenalty(Client, 2);
_IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix)
assert(Client != NULL);
assert(Req != NULL);
-
- IRC_SetPenalty(Client, 1);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
assert( Client != NULL );
assert( Req != NULL );
- IRC_SetPenalty(Client, 1);
-
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from)
assert(Client != NULL);
assert(Req != NULL);
- IRC_SetPenalty(Client, 1);
-
if (Req->argc < 2 || strcmp(Req->argv[1], "0") == 0) {
for (c = Client_First(); c!= NULL; c = Client_Next(c)) {
if (Client_Type(c) != CLIENT_SERVICE)
assert( Client != NULL );
assert( Req != NULL );
- IRC_SetPenalty(Client, 3);
-
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from)
assert( Client != NULL );
assert( Req != NULL );
- IRC_SetPenalty(Client, 1);
-
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from)
assert(Client != NULL);
assert(Req != NULL);
-
- IRC_SetPenalty(Client, 2);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 1, from)
assert(Client != NULL);
assert(Req != NULL);
- IRC_SetPenalty(Client, 1);
-
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from)
assert(Client != NULL);
assert(Req != NULL);
-
- IRC_SetPenalty(Client, 1);
if (Req->argc > 5)
max = 5;
assert( Client != NULL );
assert( Req != NULL );
- IRC_SetPenalty(Client, 1);
-
_IRC_GET_SENDER_OR_RETURN_(prefix, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, prefix)
assert (Client != NULL);
assert (Req != NULL);
- IRC_SetPenalty(Client, 1);
-
only_ops = false;
if (Req->argc == 2) {
if (strcmp(Req->argv[1], "o") == 0)
only_ops = true;
#ifdef STRICT_RFC
else {
- IRC_SetPenalty(Client, 2);
return IRC_WriteErrClient(Client,
ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client),
blob - 35f1a59a8a06b4a6fe516948be098ea312374646
blob + d6a751a0d427edb091603ad62f54f3083de57ca7
--- src/ngircd/irc.c
+++ src/ngircd/irc.c
assert(Client != NULL);
assert(Req != NULL);
-
- IRC_SetPenalty(Client, 3);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
_IRC_GET_TARGET_SERVER_OR_RETURN_(target, Req, 0, from)
assert(Client != NULL);
assert(Req != NULL);
-
- IRC_SetPenalty(Client, 2);
if ((Req->argc == 0 && array_bytes(&Conf_Helptext) > 0)
|| (Req->argc >= 1 && strcasecmp(Req->argv[0], "Commands") != 0)) {
blob - ae6f4d20f263ff3bc5f866b4a8f08feffb76361d
blob + 4235497b35e43d34aedc8f04a93c8df8237c2af4
--- src/ngircd/parse.c
+++ src/ngircd/parse.c
static COMMAND My_Commands[] =
{
-#define _CMD(name, func, type, min, max) \
- { (name), (func), (type), (min), (max), 0, 0, 0 }
- _CMD("ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0, 1),
- _CMD("AWAY", IRC_AWAY, CLIENT_USER, 0, 1),
- _CMD("CAP", IRC_CAP, CLIENT_ANY, 1, 2),
- _CMD("CONNECT", IRC_CONNECT, CLIENT_USER|CLIENT_SERVER, 0, -1),
+#define _CMD(name, func, type, min, max, penalty) \
+ { (name), (func), (type), (min), (max), (penalty), 0, 0, 0 }
+ _CMD("ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0, 1, 1),
+ _CMD("AWAY", IRC_AWAY, CLIENT_USER, 0, 1, 0),
+ _CMD("CAP", IRC_CAP, CLIENT_ANY, 1, 2, 0),
+ _CMD("CONNECT", IRC_CONNECT, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
#ifdef STRICT_RFC
- _CMD("DIE", IRC_DIE, CLIENT_USER, 0, 0),
+ _CMD("DIE", IRC_DIE, CLIENT_USER, 0, 0, 0),
#else
- _CMD("DIE", IRC_DIE, CLIENT_USER, 0, 1),
+ _CMD("DIE", IRC_DIE, CLIENT_USER, 0, 1, 0),
#endif
- _CMD("DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 1, 1),
- _CMD("ERROR", IRC_ERROR, CLIENT_ANY, 0, -1),
- _CMD("GLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1),
- _CMD("HELP", IRC_HELP, CLIENT_USER, 0, 1),
- _CMD("INFO", IRC_INFO, CLIENT_USER|CLIENT_SERVER, 0, 1),
- _CMD("INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 2, 2),
- _CMD("ISON", IRC_ISON, CLIENT_USER, 1, -1),
- _CMD("JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 1, 2),
- _CMD("KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 2, 3),
- _CMD("KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 2, 2),
- _CMD("KLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1),
- _CMD("LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 2),
- _CMD("LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 2),
- _CMD("LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 2),
- _CMD("METADATA", IRC_METADATA, CLIENT_SERVER, 3, 3),
- _CMD("MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 1, -1),
- _CMD("MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0, 1),
- _CMD("NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0, 2),
- _CMD("NICK", IRC_NICK, CLIENT_ANY, 0, -1),
- _CMD("NJOIN", IRC_NJOIN, CLIENT_SERVER, 2, 2),
- _CMD("NOTICE", IRC_NOTICE, CLIENT_ANY, 0, -1),
- _CMD("OPER", IRC_OPER, CLIENT_USER, 2, 2),
- _CMD("PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 1, 2),
- _CMD("PASS", IRC_PASS, CLIENT_ANY, 0, -1),
- _CMD("PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0, -1),
- _CMD("PONG", IRC_PONG, CLIENT_ANY, 0, -1),
- _CMD("PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0, 2),
- _CMD("QUIT", IRC_QUIT, CLIENT_ANY, 0, 1),
- _CMD("REHASH", IRC_REHASH, CLIENT_USER, 0, 0),
- _CMD("RESTART", IRC_RESTART, CLIENT_USER, 0, 0),
- _CMD("SERVER", IRC_SERVER, CLIENT_ANY, 0, -1),
- _CMD("SERVICE", IRC_SERVICE, CLIENT_ANY, 6, 6),
- _CMD("SERVLIST", IRC_SERVLIST, CLIENT_USER, 0, 2),
- _CMD("SQUERY", IRC_SQUERY, CLIENT_USER|CLIENT_SERVER, 0, 2),
- _CMD("SQUIT", IRC_SQUIT, CLIENT_USER|CLIENT_SERVER, 2, 2),
- _CMD("STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 2),
- _CMD("SVSNICK", IRC_SVSNICK, CLIENT_SERVER, 2, 2),
- _CMD("SUMMON", IRC_SUMMON, CLIENT_USER|CLIENT_SERVER, 0, -1),
- _CMD("TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 1),
- _CMD("TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 1, 2),
- _CMD("TRACE", IRC_TRACE, CLIENT_USER|CLIENT_SERVER, 0, 1),
- _CMD("USER", IRC_USER, CLIENT_ANY, 0, -1),
- _CMD("USERHOST", IRC_USERHOST, CLIENT_USER, 1, -1),
- _CMD("USERS", IRC_USERS, CLIENT_USER|CLIENT_SERVER, 0, -1),
- _CMD("VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 1),
- _CMD("WALLOPS", IRC_WALLOPS, CLIENT_USER|CLIENT_SERVER, 1, 1),
- _CMD("WEBIRC", IRC_WEBIRC, CLIENT_UNKNOWN, 4, 4),
- _CMD("WHO", IRC_WHO, CLIENT_USER, 0, 2),
- _CMD("WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, -1),
- _CMD("WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, -1),
+ _CMD("DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 1, 1, 0),
+ _CMD("ERROR", IRC_ERROR, CLIENT_ANY, 0, -1, 0),
+ _CMD("GLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
+ _CMD("HELP", IRC_HELP, CLIENT_USER, 0, 1, 2),
+ _CMD("INFO", IRC_INFO, CLIENT_USER|CLIENT_SERVER, 0, 1, 2),
+ _CMD("INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 2, 2, 0),
+ _CMD("ISON", IRC_ISON, CLIENT_USER, 1, -1, 0),
+ _CMD("JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 1, 2, 0),
+ _CMD("KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 2, 3, 0),
+ _CMD("KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 2, 2, 0),
+ _CMD("KLINE", IRC_xLINE, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
+ _CMD("LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 2, 1),
+ _CMD("LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 2, 2),
+ _CMD("LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 2, 1),
+ _CMD("METADATA", IRC_METADATA, CLIENT_SERVER, 3, 3, 0),
+ _CMD("MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 1, -1, 0),
+ _CMD("MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0, 1, 3),
+ _CMD("NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0, 2, 1),
+ _CMD("NICK", IRC_NICK, CLIENT_ANY, 0, -1, 0),
+ _CMD("NJOIN", IRC_NJOIN, CLIENT_SERVER, 2, 2, 0),
+ _CMD("NOTICE", IRC_NOTICE, CLIENT_ANY, 0, -1, 0),
+ _CMD("OPER", IRC_OPER, CLIENT_USER, 2, 2, 0),
+ _CMD("PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 1, 2, 0),
+ _CMD("PASS", IRC_PASS, CLIENT_ANY, 0, -1, 0),
+ _CMD("PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
+ _CMD("PONG", IRC_PONG, CLIENT_ANY, 0, -1, 0),
+ _CMD("PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0, 2, 0),
+ _CMD("QUIT", IRC_QUIT, CLIENT_ANY, 0, 1, 0),
+ _CMD("REHASH", IRC_REHASH, CLIENT_USER, 0, 0, 0),
+ _CMD("RESTART", IRC_RESTART, CLIENT_USER, 0, 0, 0),
+ _CMD("SERVER", IRC_SERVER, CLIENT_ANY, 0, -1, 0),
+ _CMD("SERVICE", IRC_SERVICE, CLIENT_ANY, 6, 6, 0),
+ _CMD("SERVLIST", IRC_SERVLIST, CLIENT_USER, 0, 2, 1),
+ _CMD("SQUERY", IRC_SQUERY, CLIENT_USER|CLIENT_SERVER, 0, 2, 0),
+ _CMD("SQUIT", IRC_SQUIT, CLIENT_USER|CLIENT_SERVER, 2, 2, 0),
+ _CMD("STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 2, 2),
+ _CMD("SVSNICK", IRC_SVSNICK, CLIENT_SERVER, 2, 2, 0),
+ _CMD("SUMMON", IRC_SUMMON, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
+ _CMD("TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 1, 1),
+ _CMD("TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 1, 2, 1),
+ _CMD("TRACE", IRC_TRACE, CLIENT_USER|CLIENT_SERVER, 0, 1, 3),
+ _CMD("USER", IRC_USER, CLIENT_ANY, 0, -1, 0),
+ _CMD("USERHOST", IRC_USERHOST, CLIENT_USER, 1, -1, 1),
+ _CMD("USERS", IRC_USERS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
+ _CMD("VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 1, 1),
+ _CMD("WALLOPS", IRC_WALLOPS, CLIENT_USER|CLIENT_SERVER, 1, 1, 0),
+ _CMD("WEBIRC", IRC_WEBIRC, CLIENT_UNKNOWN, 4, 4, 0),
+ _CMD("WHO", IRC_WHO, CLIENT_USER, 0, 2, 1),
+ _CMD("WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
+ _CMD("WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, -1, 0),
#ifdef IRCPLUS
- _CMD("CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, -1),
+ _CMD("CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, -1, 0),
# ifdef ICONV
- _CMD("CHARCONV", IRC_CHARCONV, CLIENT_USER, 1, 1),
+ _CMD("CHARCONV", IRC_CHARCONV, CLIENT_USER, 1, 1, 0),
# endif
#endif
#ifndef STRICT_RFC
- _CMD("GET", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1),
- _CMD("POST", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1),
+ _CMD("GET", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1, 0),
+ _CMD("POST", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, -1, 0),
#endif
- _CMD(NULL, NULL, 0, 0, 0) /* End-Mark */
+ _CMD(NULL, NULL, 0, 0, 0, 0) /* End-Mark */
#undef _CMD
};
return IRC_WriteErrClient(client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(client), Req->command);
+ if (cmd->penalty)
+ IRC_SetPenalty(client, cmd->penalty);
+
/* Command is allowed for this client: call it and count
* generated bytes in output */
Conn_ResetWCounter();
blob - beac227521b6d1d677df721b617f795b7e44bd62
blob + 859c7ce575692ee4b69ff032face09f96269ba3e
--- src/ngircd/parse.h
+++ src/ngircd/parse.h
CLIENT_TYPE type; /**< Valid client types (bit mask) */
int min_argc; /**< Min parameters */
int max_argc; /**< Max parameters */
+ int penalty; /**< Penalty for this command */
long lcount, rcount; /**< Number of local and remote calls */
long bytes; /**< Number of bytes created */
} COMMAND;