int DieDelay = 5;
time_t startup_time = time(NULL);
int NetBufferSize = 10240; // NetBufferSize used as the buffer size for all read() ops
+extern int MaxWhoResults;
time_t nb_start = 0;
+bool AllowHalfop = true;
+bool AllowProtect = true;
+bool AllowFounder = true;
+
extern vector<Module*> modules;
std::vector<std::string> module_names;
extern vector<ircd_module*> factory;
void ReadConfig(void)
{
- char dbg[MAXBUF],pauseval[MAXBUF],Value[MAXBUF],timeout[MAXBUF],NB[MAXBUF],flood[MAXBUF];
+ char dbg[MAXBUF],pauseval[MAXBUF],Value[MAXBUF],timeout[MAXBUF],NB[MAXBUF],flood[MAXBUF],MW[MAXBUF];
+ char AH[MAXBUF],AP[MAXBUF],AF[MAXBUF];
ConnectClass c;
LoadConf(CONFIG_FILE,&config_f);
ConfValue("die","value",0,DieValue,&config_f);
ConfValue("options","loglevel",0,dbg,&config_f);
ConfValue("options","netbuffersize",0,NB,&config_f);
+ ConfValue("options","maxwho",0,MW,&config_f);
+ ConfValue("options","allowhalfop",0,AH,&config_f);
+ ConfValue("options","allowprotect",0,AP,&config_f);
+ ConfValue("options","allowfounder",0,AF,&config_f);
NetBufferSize = atoi(NB);
+ MaxWhoResults = atoi(MW);
+ 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")));
if ((!NetBufferSize) || (NetBufferSize > 65535) || (NetBufferSize < 1024))
{
log(DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240.");
NetBufferSize = 10240;
}
+ if ((!MaxWhoResults) || (MaxWhoResults > 65535) || (MaxWhoResults < 1))
+ {
+ log(DEFAULT,"No MaxWhoResults specified or size out of range, setting to default of 128.");
+ MaxWhoResults = 128;
+ }
if (!strcmp(dbg,"debug"))
LogLevel = DEBUG;
if (!strcmp(dbg,"verbose"))
}
if (strcmp(chan->key,""))
{
+ strncat(sparam," ",MAXBUF);
strncat(sparam,chan->key,MAXBUF);
}
if (chan->limit)
if (!FindChan(cname))
{
+ int MOD_RESULT = 0;
FOREACH_RESULT(OnUserPreJoin(user,NULL,cname));
if (MOD_RESULT) {
return NULL;
// and bans (used by servers)
if (!override)
{
+ int MOD_RESULT = 0;
FOREACH_RESULT(OnUserPreJoin(user,Ptr,cname));
if (MOD_RESULT) {
return NULL;
{
// use the stamdard J token with no privilages.
char buffer[MAXBUF];
- snprintf(buffer,MAXBUF,"J %s %s",user->nick,Ptr->name);
+ if (created == 2)
+ {
+ snprintf(buffer,MAXBUF,"J %s @%s",user->nick,Ptr->name);
+ }
+ else
+ {
+ snprintf(buffer,MAXBUF,"J %s %s",user->nick,Ptr->name);
+ }
NetSendToAll(buffer);
}
WriteServ(src->fd,"441 %s %s %s :They are not on that channel",src->nick, user->nick, Ptr->name);
return;
}
- if (((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr))) && (!is_uline(src->server)))
+
+ int MOD_RESULT = 0;
+ FOREACH_RESULT(OnAccessCheck(src,user,Ptr,AC_KICK));
+
+ if (MOD_RESULT == ACR_DENY)
+ return;
+
+ if (MOD_RESULT == ACR_DEFAULT)
{
- if (cstatus(src,Ptr) == STATUS_HOP)
+ if (((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr))) && (!is_uline(src->server)))
{
- WriteServ(src->fd,"482 %s %s :You must be a channel operator",src->nick, Ptr->name);
- }
- else
- {
- WriteServ(src->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",src->nick, Ptr->name);
+ if (cstatus(src,Ptr) == STATUS_HOP)
+ {
+ WriteServ(src->fd,"482 %s %s :You must be a channel operator",src->nick, Ptr->name);
+ }
+ else
+ {
+ WriteServ(src->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",src->nick, Ptr->name);
+ }
+
+ return;
}
-
- return;
}
for (int i =0; i != MAXCHANS; i++)
clientlist[tempnick] = new userrec();
NonBlocking(socket);
- log(DEBUG,"AddClient: %d %s %d",socket,host,port);
+ log(DEBUG,"AddClient: %d %s %d %s",socket,host,port,ip);
clientlist[tempnick]->fd = socket;
strncpy(clientlist[tempnick]->nick, tn2,NICKMAX);
WriteOpers("*** Client connecting on port %d: %s!%s@%s",user->port,user->nick,user->ident,user->host);
char buffer[MAXBUF];
- snprintf(buffer,MAXBUF,"N %d %s %s %s %s +%s %s :%s",user->age,user->nick,user->host,user->dhost,user->ident,user->modes,ServerName,user->fullname);
+ snprintf(buffer,MAXBUF,"N %d %s %s %s %s +%s %s %s :%s",user->age,user->nick,user->host,user->dhost,user->ident,user->modes,user->ip,ServerName,user->fullname);
NetSendToAll(buffer);
}
for (int i = 0; i <= MODCOUNT; i++)
{
std::string oldtmp = tmp;
- modules[i]->OnServerRaw(tmp,true);
+ modules[i]->OnServerRaw(tmp,true,user);
if (oldtmp != tmp)
{
log(DEBUG,"A Module changed the input string!");
cmd_found = 1;
return;
}
+ if ((cmdlist[i].flags_needed) && (!user->HasPermission(command)))
+ {
+ log(DEBUG,"process_command: permission denied: %s %s",user->nick,command);
+ WriteServ(user->fd,"481 %s :Permission Denied- Oper type %s does not have access to command %s",user->nick,user->oper,command);
+ cmd_found = 1;
+ return;
+ }
/* if the command isnt USER, PASS, or NICK, and nick is empty,
* deny command! */
if ((strncmp(command,"USER",4)) && (strncmp(command,"NICK",4)) && (strncmp(command,"PASS",4)))
// send users and channels
for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
{
- snprintf(data,MAXBUF,"N %d %s %s %s %s +%s %s :%s",u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->modes,u->second->server,u->second->fullname);
+ snprintf(data,MAXBUF,"N %d %s %s %s %s +%s %s %s :%s",u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->modes,u->second->ip,u->second->server,u->second->fullname);
serv->SendPacket(data,tcp_host);
if (strcmp(chlist(u->second),""))
{
serv->SendPacket(data,tcp_host);
}
}
+ // sync global zlines, glines, etc
+ sync_xlines(serv,tcp_host);
snprintf(data,MAXBUF,"F %d",time(NULL));
serv->SendPacket(data,tcp_host);
log(DEBUG,"Sent sync");
}
else
{
- AddClient(incomingSockfd, resolved, ports[count], iscached, target);
+ AddClient(incomingSockfd, resolved, ports[count], iscached, inet_ntoa (client.sin_addr));
log(DEBUG,"InspIRCd: adding client on port %d fd=%d",ports[count],incomingSockfd);
}
goto label;