Merge pull request #285 from edk0/ratelimits

Remove ratelimits on /stats and /motd when they don't have a server parameter
This commit is contained in:
Aaron Jones 2019-09-15 19:27:39 +00:00 committed by GitHub
commit 52fae04da0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -67,17 +67,18 @@ m_motd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
{
static time_t last_used = 0;
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time() || !ratelimit_client(source_p, 6))
{
if (parc < 2) {
/* do nothing */
} else if ((last_used + ConfigFileEntry.pace_wait) > rb_current_time() || !ratelimit_client(source_p, 6)) {
/* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "MOTD");
sendto_one(source_p, form_str(RPL_ENDOFMOTD),
me.name, source_p->name);
return;
}
else
} else {
last_used = rb_current_time();
}
if(hunt_server(client_p, source_p, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME)
return;

View file

@ -212,7 +212,7 @@ m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
statchar = parv[1][0];
if(MyClient(source_p) && !IsOper(source_p))
if(MyClient(source_p) && !IsOper(source_p) && parc > 2)
{
/* Check the user is actually allowed to do /stats, and isnt flooding */
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
@ -228,7 +228,7 @@ m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
last_used = rb_current_time();
}
if(hunt_server (client_p, source_p, ":%s STATS %s :%s", 2, parc, parv) != HUNTED_ISME)
if(hunt_server(client_p, source_p, ":%s STATS %s :%s", 2, parc, parv) != HUNTED_ISME)
return;
if(tolower(statchar) != 'l')