summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-04-04 01:27:18 +0000
committercyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-04-04 01:27:18 +0000
commit9f20b2f7dda30edd418e25af295deef279f2a2ad (patch)
treeca76a4ac05614f114951b371da696a7e6510ee91
parentdf627065aca697addd21b23bee95958271655131 (diff)
Removed is_host_setter() and is_host_remover() from code and replaced them with opertype priv "hostserv/set", removed <hostserv:hostsetters> from configuration.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2260 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--data/example.conf10
-rw-r--r--include/extern.h5
-rw-r--r--src/config.c8
-rw-r--r--src/core/hs_del.c12
-rw-r--r--src/core/hs_delall.c12
-rw-r--r--src/core/hs_set.c12
-rw-r--r--src/core/hs_setall.c12
-rw-r--r--src/hostserv.c29
-rw-r--r--src/modules/hs_request.c33
9 files changed, 49 insertions, 84 deletions
diff --git a/data/example.conf b/data/example.conf
index b5f0a1130..094ae4c0c 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -1062,16 +1062,6 @@ hostserv
* to the base names of the modules for HostServ. This directive is optional, but highly recommended.
*/
modules = "hs_help hs_on hs_off hs_group hs_list hs_set hs_setall hs_del hs_delall"
-
- /*
- * Specifies the nicks of NON-OPERS allowed to set or remove vHosts using HostServ. Can be re-loaded
- * with /msg operserv reload. You can specify more than one nick by separating each one by a space.
- *
- * This directive is optional, but you are discouraged from using it. It is recommended that you only
- * give opers the ability to set or remove vHosts by making them Services Opers or higher, but if you
- * do decide to use this directive, make sure you insert the correct nick(s) here.
- */
- #hostsetters = "CyberBotX w00t"
}
/*
diff --git a/include/extern.h b/include/extern.h
index 3a602fca1..9904c9edd 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -284,9 +284,6 @@ E bool RestrictOperNicks;
E unsigned NewsCount;
E char *Numeric;
-E char **HostSetters;
-E int HostNumber;
-
E bool UseMail;
E char *SendMailPath;
E char *SendFrom;
@@ -467,8 +464,6 @@ E void hostserv_init();
E void addHostCore(const char *nick, char *vIdent, char *vhost, const char *creator, int32 tmp_time);
E char *getvIdent(char *nick);
E char *getvHost(char *nick);
-E int is_host_remover(User * u);
-E int is_host_setter(User *u);
E HostCore *hostCoreListHead();
E HostCore *findHostCore(HostCore * head, const char *nick, bool *found);
E HostCore *createHostCorelist(HostCore * next, const char *nick, char *vIdent, char *vHost, const char *creator, int32 tmp_time);
diff --git a/src/config.c b/src/config.c
index 9db7fcc00..fe04e019c 100644
--- a/src/config.c
+++ b/src/config.c
@@ -66,10 +66,6 @@ char *BotDBName;
char *OperDBName;
char *NewsDBName;
-static char *HostSetter;
-char **HostSetters;
-int HostNumber = 0; /* needs to be set to 0 */
-
bool NoBackupOkay;
bool StrictPasswords;
unsigned BadPassLimit;
@@ -892,7 +888,6 @@ int ServerConfig::Read(bool bail)
{"hostserv", "description", "vHost Service", new ValueContainerChar(&desc_HostServ), DT_CHARPTR | DT_NORELOAD, ValidateHostServ},
{"hostserv", "database", "hosts.db", new ValueContainerChar(&HostDBName), DT_CHARPTR, ValidateHostServ},
{"hostserv", "modules", "", new ValueContainerChar(&HostCoreModules), DT_CHARPTR, NoValidation},
- {"hostserv", "hostsetters", "", new ValueContainerChar(&HostSetter), DT_CHARPTR, NoValidation},
{"operserv", "nick", "OperServ", new ValueContainerChar(&s_OperServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"operserv", "description", "Operator Service", new ValueContainerChar(&desc_OperServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
{"operserv", "globalnick", "Global", new ValueContainerChar(&s_GlobalNoticer), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
@@ -1788,9 +1783,6 @@ int read_config(int reload)
} while ((s = strtok(NULL, " ")));
}
- /* Host Setters building... :P */
- HostSetters = buildStringList(HostSetter ? HostSetter : "", &HostNumber);
-
/* Modules Autoload building... :P */
ModulesAutoload = buildStringList(Modules, &ModulesNumber);
HostServCoreModules =
diff --git a/src/core/hs_del.c b/src/core/hs_del.c
index 97bb9f07d..c0d0ae40c 100644
--- a/src/core/hs_del.c
+++ b/src/core/hs_del.c
@@ -26,6 +26,12 @@ class CommandHSDel : public Command
CommandReturn Execute(User *u, std::vector<std::string> &params)
{
+ if (!u->nc->HasPriv("hostserv/set"))
+ {
+ notice_lang(s_HostServ, u, ACCESS_DENIED);
+ return MOD_CONT;
+ }
+
NickAlias *na;
const char *nick = params[0].c_str();
if ((na = findnick(nick)))
@@ -46,9 +52,6 @@ class CommandHSDel : public Command
bool OnHelp(User *u, const std::string &subcommand)
{
- if (!is_host_remover(u))
- return false;
-
notice_help(s_HostServ, u, HOST_HELP_DEL);
return true;
}
@@ -80,8 +83,7 @@ class HSDel : public Module
**/
void myHostServHelp(User *u)
{
- if (is_host_remover(u))
- notice_lang(s_HostServ, u, HOST_HELP_CMD_DEL);
+ notice_lang(s_HostServ, u, HOST_HELP_CMD_DEL);
}
MODULE_INIT("hs_del", HSDel)
diff --git a/src/core/hs_delall.c b/src/core/hs_delall.c
index 60d64639e..4de865ebe 100644
--- a/src/core/hs_delall.c
+++ b/src/core/hs_delall.c
@@ -26,6 +26,12 @@ class CommandHSDelAll : public Command
CommandReturn Execute(User *u, std::vector<std::string> &params)
{
+ if (!u->nc->HasPriv("hostserv/set"))
+ {
+ notice_lang(s_HostServ, u, ACCESS_DENIED);
+ return MOD_CONT;
+ }
+
int i;
const char *nick = params[0].c_str();
NickAlias *na;
@@ -53,9 +59,6 @@ class CommandHSDelAll : public Command
bool OnHelp(User *u, const std::string &subcommand)
{
- if (!is_host_remover(u))
- return false;
-
notice_help(s_HostServ, u, HOST_HELP_DELALL);
return true;
}
@@ -87,8 +90,7 @@ class HSDelAll : public Module
**/
void myHostServHelp(User *u)
{
- if (is_host_remover(u))
- notice_lang(s_HostServ, u, HOST_HELP_CMD_DELALL);
+ notice_lang(s_HostServ, u, HOST_HELP_CMD_DELALL);
}
MODULE_INIT("hs_delall", HSDelAll)
diff --git a/src/core/hs_set.c b/src/core/hs_set.c
index fd66ca911..a117f7540 100644
--- a/src/core/hs_set.c
+++ b/src/core/hs_set.c
@@ -26,6 +26,12 @@ class CommandHSSet : public Command
CommandReturn Execute(User *u, std::vector<std::string> &params)
{
+ if (!u->nc->HasPriv("hostserv/set"))
+ {
+ notice_lang(s_HostServ, u, ACCESS_DENIED);
+ return MOD_CONT;
+ }
+
const char *nick = params[0].c_str();
const char *rawhostmask = params[1].c_str();
char *hostmask = new char[HOSTMAX];
@@ -143,9 +149,6 @@ class CommandHSSet : public Command
bool OnHelp(User *u, const std::string &subcommand)
{
- if (!is_host_setter(u))
- return false;
-
notice_help(s_HostServ, u, HOST_HELP_SET);
return true;
}
@@ -177,8 +180,7 @@ class HSSet : public Module
**/
void myHostServHelp(User *u)
{
- if (is_host_setter(u))
- notice_lang(s_HostServ, u, HOST_HELP_CMD_SET);
+ notice_lang(s_HostServ, u, HOST_HELP_CMD_SET);
}
MODULE_INIT("hs_set", HSSet)
diff --git a/src/core/hs_setall.c b/src/core/hs_setall.c
index 6811bb7f3..1177ca5d8 100644
--- a/src/core/hs_setall.c
+++ b/src/core/hs_setall.c
@@ -27,6 +27,12 @@ class CommandHSSetAll : public Command
CommandReturn Execute(User *u, std::vector<std::string> &params)
{
+ if (!u->nc->HasPriv("hostserv/set"))
+ {
+ notice_lang(s_HostServ, u, ACCESS_DENIED);
+ return MOD_CONT;
+ }
+
const char *nick = params[0].c_str();
const char *rawhostmask = params[1].c_str();
char *hostmask = new char[HOSTMAX];
@@ -143,9 +149,6 @@ class CommandHSSetAll : public Command
bool OnHelp(User *u, const std::string &subcommand)
{
- if (!is_host_setter(u))
- return false;
-
notice_help(s_HostServ, u, HOST_HELP_SETALL);
return true;
}
@@ -176,8 +179,7 @@ class HSSetAll : public Module
**/
void myHostServHelp(User *u)
{
- if (is_host_setter(u))
- notice_lang(s_HostServ, u, HOST_HELP_CMD_SETALL);
+ notice_lang(s_HostServ, u, HOST_HELP_CMD_SETALL);
}
MODULE_INIT("hs_setall", HSSetAll)
diff --git a/src/hostserv.c b/src/hostserv.c
index ec57ac841..e3b3eac6f 100644
--- a/src/hostserv.c
+++ b/src/hostserv.c
@@ -514,35 +514,6 @@ int do_on_id(User * u)
}
/*************************************************************************/
-int is_host_setter(User * u)
-{
- int i, j;
- NickAlias *na;
-
- if (u->nc && u->nc->IsServicesOper()) {
- return 1;
- }
- if (!nick_identified(u)) {
- return 0;
- }
-
- /* Look through all user's aliases (0000412) */
- for (i = 0; i < u->nc->aliases.count; i++) {
- na = static_cast<NickAlias *>(u->nc->aliases.list[i]);
- for (j = 0; j < HostNumber; j++) {
- if (stricmp(HostSetters[j], na->nick) == 0) {
- return 1;
- }
- }
- }
-
- return 0;
-}
-
-int is_host_remover(User * u)
-{
- return is_host_setter(u); /* only here incase we want to split them up later */
-}
/*
* Sets the last_usermak properly. Using virtual ident and/or host
diff --git a/src/modules/hs_request.c b/src/modules/hs_request.c
index 9d043e6d0..6902ef129 100644
--- a/src/modules/hs_request.c
+++ b/src/modules/hs_request.c
@@ -210,6 +210,12 @@ class CommandHSActivate : public Command
CommandReturn Execute(User *u, std::vector<std::string> &params)
{
+ if (!u->nc->HasPriv("hostserv/set"))
+ {
+ notice_lang(s_HostServ, u, ACCESS_DENIED);
+ return MOD_CONT;
+ }
+
const char *nick = params[0].c_str();
NickAlias *na;
HostCore *tmp, *hc;
@@ -245,9 +251,6 @@ class CommandHSActivate : public Command
bool OnHelp(User *u, const std::string &subcommand)
{
- if (!is_host_setter(u))
- return false;
-
me->NoticeLang(s_HostServ, u, LNG_ACTIVATE_SYNTAX);
ircdproto->SendMessage(findbot(s_HostServ), u->nick, " ");
me->NoticeLang(s_HostServ, u, LNG_HELP_ACTIVATE);
@@ -272,6 +275,12 @@ class CommandHSReject : public Command
CommandReturn Execute(User *u, std::vector<std::string> &params)
{
+ if (!u->nc->HasPriv("hostserv/set"))
+ {
+ notice_lang(s_HostServ, u, ACCESS_DENIED);
+ return MOD_CONT;
+ }
+
const char *nick = params[0].c_str();
const char *reason = params.size() > 1 ? params[1].c_str() : NULL;
HostCore *tmp, *hc;
@@ -305,9 +314,6 @@ class CommandHSReject : public Command
bool OnHelp(User *u, const std::string &subcommand)
{
- if (!is_host_setter(u))
- return false;
-
me->NoticeLang(s_HostServ, u, LNG_REJECT_SYNTAX);
ircdproto->SendMessage(findbot(s_HostServ), u->nick, " ");
me->NoticeLang(s_HostServ, u, LNG_HELP_REJECT);
@@ -328,6 +334,12 @@ class HSListBase : public Command
protected:
CommandReturn DoList(User *u, std::vector<std::string> &params)
{
+ if (!u->nc->HasPriv("hostserv/set"))
+ {
+ notice_lang(s_HostServ, u, ACCESS_DENIED);
+ return MOD_CONT;
+ }
+
struct tm *tm;
char buf[BUFSIZE];
int counter = 1;
@@ -380,9 +392,6 @@ class CommandHSWaiting : public HSListBase
bool OnHelp(User *u, const std::string &subcommand)
{
- if (!is_host_setter(u))
- return false;
-
me->NoticeLang(s_HostServ, u, LNG_WAITING_SYNTAX);
ircdproto->SendMessage(findbot(s_HostServ), u->nick, " ");
me->NoticeLang(s_HostServ, u, LNG_HELP_WAITING);
@@ -829,8 +838,9 @@ void req_send_memos(User *u, char *vIdent, char *vHost)
}
if (HSRequestMemoSetters == 1)
{
+ /* Needs to be rethought because of removal of HostSetters in favor of opertype priv -- CyberBotX
for (i = 0; i < HostNumber; ++i)
- my_memo_lang(u, HostSetters[i], z, LNG_REQUEST_MEMO, host);
+ my_memo_lang(u, HostSetters[i], z, LNG_REQUEST_MEMO, host);*/
}
}
@@ -864,8 +874,7 @@ int my_isvalidchar(const char c)
void hs_help(User * u)
{
me->NoticeLang(s_HostServ, u, LNG_HELP);
- if (is_host_setter(u))
- me->NoticeLang(s_HostServ, u, LNG_HELP_SETTER);
+ me->NoticeLang(s_HostServ, u, LNG_HELP_SETTER);
}
void hsreq_load_db()