summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-03-27 19:46:15 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-03-27 19:46:15 +0000
commitaea30280acf0a8faaca910815cad4e9530565685 (patch)
treeece725042769ff33f5ff3502cd2e440412f1cea0 /src
parentdac485fc0946c9b351e317d7233062b453696ead (diff)
Fixed detection of missing opertypes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@920 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/commands.cpp61
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/modules/m_blockcolor.cpp20
3 files changed, 58 insertions, 25 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index c47da8a61..9385ae3f3 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -1488,16 +1488,21 @@ void handle_oper(char **parameters, int pcnt, userrec *user)
char Hostname[MAXBUF];
int i,j;
bool found = false;
+ bool fail2 = false;
+ char global[MAXBUF];
for (int i = 0; i < ConfValueEnum("oper",&config_f); i++)
{
ConfValue("oper","name",i,LoginName,&config_f);
ConfValue("oper","password",i,Password,&config_f);
+ ConfValue("oper","type",i,OperType,&config_f);
if ((!strcmp(LoginName,parameters[0])) && (!strcmp(Password,parameters[1])))
{
+ fail2 = true;
for (j =0; j < ConfValueEnum("type",&config_f); j++)
{
ConfValue("type","name",j,TypeName,&config_f);
+
if (!strcmp(TypeName,OperType))
{
/* found this oper's opertype */
@@ -1507,34 +1512,42 @@ void handle_oper(char **parameters, int pcnt, userrec *user)
ChangeDisplayedHost(user,Hostname);
strlcpy(user->oper,TypeName,NICKMAX);
found = true;
+ fail2 = false;
+ break;
}
}
- if (found)
- {
- /* correct oper credentials */
- ConfValue("oper","type",i,OperType,&config_f);
- WriteOpers("*** %s (%s@%s) is now an IRC operator of type %s",user->nick,user->ident,user->host,OperType);
- WriteServ(user->fd,"381 %s :You are now an IRC operator of type %s",user->nick,OperType);
- if (!strchr(user->modes,'o'))
- {
- strcat(user->modes,"o");
- WriteServ(user->fd,"MODE %s :+o",user->nick);
- char global[MAXBUF];
- snprintf(global,MAXBUF,"M %s +o",user->nick);
- NetSendToAll(global);
- FOREACH_MOD OnOper(user);
- }
- }
- else
- {
- WriteOpers("*** BROKEN CONFIGURATION! *** Oper type %s for oper %s not found!",OperType,LoginName);
- }
- return;
+ }
+ if (found)
+ break;
+ }
+ if (found)
+ {
+ /* correct oper credentials */
+ WriteOpers("*** %s (%s@%s) is now an IRC operator of type %s",user->nick,user->ident,user->host,OperType);
+ WriteServ(user->fd,"381 %s :You are now an IRC operator of type %s",user->nick,OperType);
+ if (!strchr(user->modes,'o'))
+ {
+ strcat(user->modes,"o");
+ WriteServ(user->fd,"MODE %s :+o",user->nick);
+ snprintf(global,MAXBUF,"M %s +o",user->nick);
+ NetSendToAll(global);
+ FOREACH_MOD OnOper(user);
+ }
+ }
+ else
+ {
+ if (!fail2)
+ {
+ WriteServ(user->fd,"491 %s :Invalid oper credentials",user->nick);
+ WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s!",user->nick,user->ident,user->host);
+ }
+ else
+ {
+ WriteServ(user->fd,"491 %s :Your oper block does not have a valid opertype associated with it",user->nick);
+ WriteOpers("*** CONFIGURATION ERROR! Oper block mismatch for OperType %s",OperType);
}
}
- /* no such oper */
- WriteServ(user->fd,"491 %s :Invalid oper credentials",user->nick);
- WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s!",user->nick,user->ident,user->host);
+ return;
}
void handle_nick(char **parameters, int pcnt, userrec *user)
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index ed1c37c73..5e1c874f2 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -2399,7 +2399,7 @@ void ConnectUser(userrec *user)
WriteServ(user->fd,"002 %s :Your host is %s, running version %s",user->nick,ServerName,VERSION);
WriteServ(user->fd,"003 %s :This server was created %s %s",user->nick,__TIME__,__DATE__);
WriteServ(user->fd,"004 %s %s %s iowghraAsORVSxNCWqBzvdHtGI lvhopsmntikrRcaqOALQbSeKVfHGCuzN",user->nick,ServerName,VERSION);
- std::string data005 = "WALLCHOPS MODES=13 CHANTYPES=# PREFIX=(ohv)@%+MAP SAFELIST MAXCHANNELS=20 MAXBANS=60 NICKLEN=30 TOPICLEN=307 KICKLEN=307 MAXTARGETS=20 AWAYLEN=307 CHANMODES=ohvbe,k,l,psmnti NETWORK=" + std::string(Network);
+ std::string data005 = "WALLCHOPS MODES=13 CHANTYPES=# PREFIX=(ohv)@%+MAP SAFELIST MAXCHANNELS=20 MAXBANS=60 NICKLEN=30 TOPICLEN=307 KICKLEN=307 MAXTARGETS=20 AWAYLEN=307 CHANMODES=ohvb,k,l,psmnti NETWORK=" + std::string(Network);
FOREACH_MOD On005Numeric(data005);
WriteServ(user->fd,"005 %s %s :are supported by this server",user->nick,data005.c_str());
ShowMOTD(user);
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index fb98709a4..dc86d6e15 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -15,6 +15,7 @@
*/
#include <stdio.h>
+#include <sstream>
#include "users.h"
#include "channels.h"
#include "modules.h"
@@ -31,6 +32,25 @@ class ModuleBlockColor : public Module
Srv = new Server;
Srv->AddExtendedMode('c',MT_CHANNEL,false,0,0);
}
+
+ virtual void On005Numeric(std::string &output)
+ {
+ // we don't really have a limit...
+ std::stringstream line(output);
+ std::string temp1, temp2;
+ while (!line.eof())
+ {
+ line >> temp1;
+ if (temp1.substr(0,10) == "CHANMODES=")
+ {
+ // append the chanmode to the end
+ temp1 = temp1.substr(10,temp1.length());
+ temp1 = "CHANMODES=" + temp1 + "c";
+ }
+ temp2 = temp2 + temp1 + " ";
+ }
+ output = temp2.substr(0,temp2.length()-1);
+ }
virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text)
{