summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-06 19:15:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-06 19:15:16 +0000
commitc557e21633df67fae9998eb888fc1141bfb6ac6c (patch)
treef6f481f1c4836725461523353ab28bd78415f9ac
parent607caf3ff38e3d72218adb669a205c1f3633a3f3 (diff)
Alright, who forgot to make /oper check hostnames?
Added logging for why oper-ups fail git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@992 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/commands.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 7dbec94fb..c563e3ebc 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -1513,18 +1513,22 @@ void handle_oper(char **parameters, int pcnt, userrec *user)
char Password[MAXBUF];
char OperType[MAXBUF];
char TypeName[MAXBUF];
- char Hostname[MAXBUF];
+ char HostName[MAXBUF];
+ char TheHost[MAXBUF];
int i,j;
bool found = false;
bool fail2 = false;
char global[MAXBUF];
+ snprintf(TheHost,MAXBUF,"%s@%s",user->ident,user->host);
+
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])))
+ ConfValue("oper","host",i,HostName,&config_f);
+ if ((!strcmp(LoginName,parameters[0])) && (!strcmp(Password,parameters[1])) && (match(TheHost,HostName)))
{
fail2 = true;
for (j =0; j < ConfValueEnum("type",&config_f); j++)
@@ -1536,8 +1540,8 @@ void handle_oper(char **parameters, int pcnt, userrec *user)
/* found this oper's opertype */
snprintf(global,MAXBUF,"| %s %s",user->nick,TypeName);
NetSendToAll(global);
- ConfValue("type","host",j,Hostname,&config_f);
- ChangeDisplayedHost(user,Hostname);
+ ConfValue("type","host",j,HostName,&config_f);
+ ChangeDisplayedHost(user,HostName);
strlcpy(user->oper,TypeName,NICKMAX);
found = true;
fail2 = false;
@@ -1568,11 +1572,13 @@ void handle_oper(char **parameters, int pcnt, userrec *user)
{
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);
+ log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.",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);
+ log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host);
}
}
return;