time_t nb_start = 0;
int dns_timeout = 5;
+char DisabledCommands[MAXBUF];
+
bool AllowHalfop = true;
bool AllowProtect = true;
bool AllowFounder = true;
int boundPortCount = 0;
int portCount = 0, UDPportCount = 0, ports[MAXSOCKS];
int defaultRoute = 0;
+char ModPath[MAXBUF];
connection C;
void ReadConfig(bool bail, userrec* user)
{
char dbg[MAXBUF],pauseval[MAXBUF],Value[MAXBUF],timeout[MAXBUF],NB[MAXBUF],flood[MAXBUF],MW[MAXBUF];
- char AH[MAXBUF],AP[MAXBUF],AF[MAXBUF],DNT[MAXBUF];
+ char AH[MAXBUF],AP[MAXBUF],AF[MAXBUF],DNT[MAXBUF],pfreq[MAXBUF];
ConnectClass c;
std::stringstream errstr;
ConfValue("options","allowfounder",0,AF,&config_f);
ConfValue("dns","server",0,DNSServer,&config_f);
ConfValue("dns","timeout",0,DNT,&config_f);
+ ConfValue("options","moduledir",0,ModPath,&config_f);
+ ConfValue("disabled","commands",0,DisabledCommands,&config_f);
+
NetBufferSize = atoi(NB);
MaxWhoResults = atoi(MW);
dns_timeout = atoi(DNT);
dns_timeout = 5;
if (!strcmp(DNSServer,""))
strlcpy(DNSServer,"127.0.0.1",MAXBUF);
+ if (!strcmp(ModPath,""))
+ strlcpy(ModPath,MOD_PATH,MAXBUF);
AllowHalfop = ((!strcasecmp(AH,"true")) || (!strcasecmp(AH,"1")) || (!strcasecmp(AH,"yes")));
AllowProtect = ((!strcasecmp(AP,"true")) || (!strcasecmp(AP,"1")) || (!strcasecmp(AP,"yes")));
AllowFounder = ((!strcasecmp(AF,"true")) || (!strcasecmp(AF,"1")) || (!strcasecmp(AF,"yes")));
ConfValue("connect","allow",i,Value,&config_f);
ConfValue("connect","timeout",i,timeout,&config_f);
ConfValue("connect","flood",i,flood,&config_f);
+ ConfValue("connect","pingfreq",i,pfreq,&config_f);
if (strcmp(Value,""))
{
strlcpy(c.host,Value,MAXBUF);
ConfValue("connect","password",i,Value,&config_f);
strlcpy(c.pass,Value,MAXBUF);
c.registration_timeout = 90; // default is 2 minutes
+ c.pingtime = 120;
c.flood = atoi(flood);
if (atoi(timeout)>0)
{
c.registration_timeout = atoi(timeout);
}
+ if (atoi(pfreq)>0)
+ {
+ c.pingtime = atoi(pfreq);
+ }
Classes.push_back(c);
log(DEBUG,"Read connect class type ALLOW, host=%s password=%s timeout=%d flood=%d",c.host,c.pass,c.registration_timeout,c.flood);
}
log(DEBUG,"NetSendToCommon: '%s' '%s'",u->nick,s);
+ std::string msg = buffer;
+ FOREACH_MOD OnPacketTransmit(msg,s);
+ strlcpy(buffer,msg.c_str(),MAXBUF);
+
for (int j = 0; j < 32; j++)
{
if (me[j] != NULL)
log(DEBUG,"NetSendToAll: '%s'",s);
+ std::string msg = buffer;
+ FOREACH_MOD OnPacketTransmit(msg,s);
+ strlcpy(buffer,msg.c_str(),MAXBUF);
+
for (int j = 0; j < 32; j++)
{
if (me[j] != NULL)
log(DEBUG,"NetSendToAllAlive: '%s'",s);
+ std::string msg = buffer;
+ FOREACH_MOD OnPacketTransmit(msg,s);
+ strlcpy(buffer,msg.c_str(),MAXBUF);
+
for (int j = 0; j < 32; j++)
{
if (me[j] != NULL)
log(DEBUG,"NetSendToOne: '%s' '%s'",target,s);
+ std::string msg = buffer;
+ FOREACH_MOD OnPacketTransmit(msg,s);
+ strlcpy(buffer,msg.c_str(),MAXBUF);
+
for (int j = 0; j < 32; j++)
{
if (me[j] != NULL)
log(DEBUG,"NetSendToAllExcept: '%s' '%s'",target,s);
+ std::string msg = buffer;
+ FOREACH_MOD OnPacketTransmit(msg,s);
+ strlcpy(buffer,msg.c_str(),MAXBUF);
+
for (int j = 0; j < 32; j++)
{
if (me[j] != NULL)
strncpy(clientlist[tempnick]->ident, "unknown",9);
clientlist[tempnick]->registered = 0;
clientlist[tempnick]->signon = TIME+dns_timeout;
- clientlist[tempnick]->nping = TIME+240+dns_timeout;
clientlist[tempnick]->lastping = 1;
clientlist[tempnick]->port = port;
strncpy(clientlist[tempnick]->ip,ip,32);
{
class_regtimeout = (unsigned long)i->registration_timeout;
class_flood = i->flood;
+ clientlist[tempnick]->pingmax = i->pingtime;
break;
}
}
+ clientlist[tempnick]->nping = TIME+clientlist[tempnick]->pingmax+dns_timeout;
clientlist[tempnick]->timeout = TIME+class_regtimeout;
clientlist[tempnick]->flood = class_flood;
log(DEBUG,"Processing command");
/* activity resets the ping pending timer */
- user->nping = TIME + 120;
+ user->nping = TIME + user->pingmax;
if ((items) < cmdlist[i].min_params)
{
log(DEBUG,"process_command: not enough parameters: %s %s",user->nick,command);
WriteServ(user->fd,"451 %s :You have not registered",command);
return;
}
+ }
+ if ((user->registered == 7) && (!strchr(user->modes,'o')))
+ {
+ char* mycmd;
+ char* savept2;
+ mycmd = strtok_r(DisabledCommands," ",&savept2);
+ while (mycmd)
+ {
+ if (!strcasecmp(mycmd,command))
+ {
+ // command is disabled!
+ WriteServ(user->fd,"421 %s %s :This command has been disabled.",user->nick,command);
+ return;
+ }
+ mycmd = strtok_r(NULL," ",&savept2);
+ }
+
+
}
if ((user->registered == 7) || (!strcmp(command,"USER")) || (!strcmp(command,"NICK")) || (!strcmp(command,"PASS")))
{
createcommand("WALLOPS",handle_wallops,'o',1,"<core>");
createcommand("NOTICE",handle_notice,0,2,"<core>");
createcommand("JOIN",handle_join,0,1,"<core>");
- createcommand("NAMES",handle_names,0,1,"<core>");
+ createcommand("NAMES",handle_names,0,0,"<core>");
createcommand("PART",handle_part,0,1,"<core>");
createcommand("KICK",handle_kick,0,2,"<core>");
createcommand("MODE",handle_mode,0,1,"<core>");
bool LoadModule(const char* filename)
{
char modfile[MAXBUF];
- snprintf(modfile,MAXBUF,"%s/%s",MOD_PATH,filename);
+ snprintf(modfile,MAXBUF,"%s/%s",ModPath,filename);
if (!DirValid(modfile))
{
log(DEFAULT,"Module %s is not within the modules directory.",modfile);
else
NetSendToAllExcept(tcp_host,udp_msg);
}
- FOREACH_MOD OnPacketReceive(udp_msg);
- handle_link_packet(udp_msg, tcp_host, me[x]);
+ std::string msg = udp_msg;
+ FOREACH_MOD OnPacketReceive(msg,tcp_host);
+ strlcpy(udp_msg,msg.c_str(),MAXBUF);
}
goto label;
}
Write(count2->second->fd,"PING :%s",ServerName);
log(DEBUG,"InspIRCd: pinging: %s",count2->second->nick);
count2->second->lastping = 0;
- count2->second->nping = TIME+120;
+ count2->second->nping = TIME+count2->second->pingmax; // was hard coded to 120
}
}
count2++;