summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/extra/m_ldapauth.cpp7
-rw-r--r--src/modules/m_cgiirc.cpp4
-rw-r--r--src/modules/m_cloaking.cpp2
-rw-r--r--src/modules/m_override.cpp2
-rw-r--r--src/modules/m_sqlauth.cpp2
-rw-r--r--src/modules/m_testnet.cpp4
-rw-r--r--src/modules/m_uninvite.cpp31
7 files changed, 25 insertions, 27 deletions
diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp
index 26e968367..af676de44 100644
--- a/src/modules/extra/m_ldapauth.cpp
+++ b/src/modules/extra/m_ldapauth.cpp
@@ -127,17 +127,16 @@ public:
return MOD_RES_PASSTHRU;
}
- bool CheckCredentials(User* user)
+ bool CheckCredentials(LocalUser* user)
{
if (conn == NULL)
if (!Connect())
return false;
int res;
- char* authpass = strdup(password.c_str());
// bind anonymously if no bind DN and authentication are given in the config
struct berval cred;
- cred.bv_val = authpass;
+ cred.bv_val = const_cast<char*>(password.c_str());
cred.bv_len = password.length();
if ((res = ldap_sasl_bind_s(conn, username.c_str(), LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL)) != LDAP_SUCCESS)
@@ -155,13 +154,11 @@ public:
{
if (verbose)
ServerInstance->SNO->WriteToSnoMask('c', "Forbidden connection from %s!%s@%s (LDAP bind failed: %s)", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), ldap_err2string(res));
- free(authpass);
ldap_unbind_ext(conn, NULL, NULL);
conn = NULL;
return false;
}
}
- free(authpass);
LDAPMessage *msg, *entry;
std::string what = (attribute + "=" + (useusername ? user->ident : user->nick));
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index 745dc13d2..5f8cfeca7 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -277,7 +277,7 @@ public:
}
}
- bool CheckPass(User* user)
+ bool CheckPass(LocalUser* user)
{
if(IsValidHost(user->password))
{
@@ -324,7 +324,7 @@ public:
return false;
}
- bool CheckIdent(User* user)
+ bool CheckIdent(LocalUser* user)
{
const char* ident;
int len = user->ident.length();
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index 0ad790de9..c0ebbc99b 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -57,7 +57,7 @@ class CloakUser : public ModeHandler
}
/* don't allow this user to spam modechanges */
- dest->IncreasePenalty(5);
+ IS_LOCAL(dest)->Penalty += 5;
if (adding)
{
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index e37282525..8a3fcdd62 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -135,7 +135,7 @@ class ModuleOverride : public Module
if ((chan->modes[CM_INVITEONLY]) && (CanOverride(user,"INVITE")))
{
irc::string x(chan->name.c_str());
- if (!user->IsInvited(x))
+ if (!IS_LOCAL(user)->IsInvited(x))
{
if (RequireKey && keygiven != "override")
{
diff --git a/src/modules/m_sqlauth.cpp b/src/modules/m_sqlauth.cpp
index a4c237e4e..3a4461480 100644
--- a/src/modules/m_sqlauth.cpp
+++ b/src/modules/m_sqlauth.cpp
@@ -85,7 +85,7 @@ public:
return MOD_RES_PASSTHRU;
}
- bool CheckCredentials(User* user)
+ bool CheckCredentials(LocalUser* user)
{
std::string thisquery = freeformquery;
std::string safepass = user->password;
diff --git a/src/modules/m_testnet.cpp b/src/modules/m_testnet.cpp
index 6a0cfa303..7f825a728 100644
--- a/src/modules/m_testnet.cpp
+++ b/src/modules/m_testnet.cpp
@@ -32,9 +32,9 @@ class CommandTest : public Command
for(unsigned int i=0; i < count; i++)
user->Write(line);
}
- else if (parameters[0] == "freeze")
+ else if (parameters[0] == "freeze" && IS_LOCAL(user))
{
- user->Penalty += 100;
+ IS_LOCAL(user)->Penalty += 100;
}
else if (parameters[0] == "shutdown")
{
diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp
index 1215dd0df..fff51817e 100644
--- a/src/modules/m_uninvite.cpp
+++ b/src/modules/m_uninvite.cpp
@@ -56,28 +56,29 @@ class CommandUninvite : public Command
irc::string xname(c->name.c_str());
- if (!u->IsInvited(xname))
+ if (IS_LOCAL(u))
{
- user->WriteNumeric(505, "%s %s %s :Is not invited to channel %s", user->nick.c_str(), u->nick.c_str(), c->name.c_str(), c->name.c_str());
- return CMD_FAILURE;
- }
- if (!c->HasUser(user))
- {
- user->WriteNumeric(492, "%s %s :You're not on that channel!",user->nick.c_str(), c->name.c_str());
- return CMD_FAILURE;
+ // TODO send messages & such out to remote servers
+ LocalUser* lu = IS_LOCAL(u);
+ if (!lu->IsInvited(xname))
+ {
+ user->WriteNumeric(505, "%s %s %s :Is not invited to channel %s", user->nick.c_str(), u->nick.c_str(), c->name.c_str(), c->name.c_str());
+ return CMD_FAILURE;
+ }
+ user->WriteNumeric(494, "%s %s %s :Uninvited", user->nick.c_str(), c->name.c_str(), u->nick.c_str());
+ lu->RemoveInvite(xname);
+ lu->WriteNumeric(493, "%s :You were uninvited from %s by %s", u->nick.c_str(), c->name.c_str(), user->nick.c_str());
+ c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s uninvited %s.",
+ c->name.c_str(), user->nick.c_str(), u->nick.c_str());
}
- u->RemoveInvite(xname);
- user->WriteNumeric(494, "%s %s %s :Uninvited", user->nick.c_str(), c->name.c_str(), u->nick.c_str());
- u->WriteNumeric(493, "%s :You were uninvited from %s by %s", u->nick.c_str(), c->name.c_str(), user->nick.c_str());
- c->WriteChannelWithServ(ServerInstance->Config->ServerName.c_str(), "NOTICE %s :*** %s uninvited %s.", c->name.c_str(), user->nick.c_str(), u->nick.c_str());
-
return CMD_SUCCESS;
}
RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
{
- return ROUTE_BROADCAST;
+ User* u = ServerInstance->FindNick(parameters[0]);
+ return u ? ROUTE_UNICAST(u->server) : ROUTE_LOCALONLY;
}
};
@@ -98,7 +99,7 @@ class ModuleUninvite : public Module
virtual Version GetVersion()
{
- return Version("Provides the UNINVITE command which lets users un-invite other users from channels (!)", VF_VENDOR | VF_COMMON);
+ return Version("Provides the UNINVITE command which lets users un-invite other users from channels", VF_VENDOR | VF_COMMON);
}
};