Remove shared blocks

This commit is contained in:
Ed Kellett 2020-10-31 15:03:46 +00:00
parent c07751a50d
commit f57d88bc71
17 changed files with 4 additions and 421 deletions

View file

@ -92,13 +92,6 @@ mo_die(struct MsgBuf *msgbuf_p __unused, struct Client *client_p __unused, struc
static void
me_die(struct MsgBuf *msgbuf_p __unused, struct Client *client_p __unused, struct Client *source_p, int parc, const char *parv[])
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_DIE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block to "
"remotely shut down this server.");
return;
}
do_die(source_p, parv[1]);
}

View file

@ -111,13 +111,6 @@ mo_modload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
static void
me_modload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return;
}
do_modload(source_p, parv[1]);
}
@ -147,13 +140,6 @@ mo_modunload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
static void
me_modunload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return;
}
do_modunload(source_p, parv[1]);
}
@ -182,13 +168,6 @@ mo_modreload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
static void
me_modreload(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return;
}
do_modreload(source_p, parv[1]);
}
@ -217,13 +196,6 @@ mo_modlist(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
static void
me_modlist(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return;
}
do_modlist(source_p, parv[1]);
}
@ -252,13 +224,6 @@ mo_modrestart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *s
static void
me_modrestart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block "
"to load modules on this server.");
return;
}
do_modrestart(source_p);
}

View file

@ -195,11 +195,6 @@ me_dline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!IsPerson(source_p))
return;
if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name,
tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE))
return;
apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3]));
check_dlines();
@ -211,10 +206,6 @@ me_undline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
if(!IsPerson(source_p))
return;
if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name, SHARED_UNDLINE))
return;
apply_undline(source_p, parv[1]);
}

View file

@ -75,14 +75,6 @@ me_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
return;
}
if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name, SHARED_GRANT))
{
sendto_one(source_p, ":%s NOTICE %s :You don't have an appropriate shared"
"block to grant privilege on this server.", me.name, source_p->name);
return;
}
do_grant(source_p, target_p, parv[2]);
}

View file

@ -283,11 +283,6 @@ handle_remote_kline(struct Client *source_p, int tkline_time,
struct ConfItem *aconf = NULL;
char *oper_reason;
if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name,
(tkline_time > 0) ? SHARED_TKLINE : SHARED_PKLINE))
return;
if(!valid_user_host(source_p, user, host))
return;
@ -469,10 +464,6 @@ handle_remote_unkline(struct Client *source_p, const char *user, const char *hos
{
struct ConfItem *aconf;
if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name, SHARED_UNKLINE))
return;
aconf = find_exact_conf_by_address(host, CONF_KILL, user);
if(aconf == NULL)
{

View file

@ -408,9 +408,5 @@ me_rehash(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
if (!IsPerson(source_p))
return;
if (!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name, SHARED_REHASH))
return;
do_rehash(source_p, parc > 1 ? parv[1] : NULL);
}

View file

@ -94,13 +94,6 @@ mo_restart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
static void
me_restart(struct MsgBuf *msgbuf_p __unused, struct Client *client_p __unused, struct Client *source_p, int parc, const char *parv[])
{
if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_DIE))
{
sendto_one_notice(source_p, ":*** You do not have an appropriate shared block to "
"remotely restart this server.");
return;
}
do_restart(source_p, parv[1]);
}

View file

@ -193,12 +193,6 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te
{
struct ConfItem *aconf;
if(!MyClient(source_p) &&
!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name,
(temp_time > 0) ? SHARED_TRESV : SHARED_PRESV))
return;
if(IsChannelName(name))
{
if(hash_find_resv(name))
@ -489,13 +483,7 @@ me_unresv(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
static void
handle_remote_unresv(struct Client *source_p, const char *name)
{
if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name, SHARED_UNRESV))
return;
remove_resv(source_p, name, 0);
return;
}
static void

View file

@ -120,7 +120,6 @@ static void stats_ssld(struct Client *);
static void stats_usage(struct Client *);
static void stats_tstats(struct Client *);
static void stats_uptime(struct Client *);
static void stats_shared(struct Client *);
static void stats_servers(struct Client *);
static void stats_tgecos(struct Client *);
static void stats_gecos(struct Client *);
@ -183,7 +182,6 @@ static struct stats_cmd stats_cmd_table[256] = {
['t'] = HANDLER_NORM(stats_tstats, false, "oper:general"),
['T'] = HANDLER_NORM(stats_tstats, false, "oper:general"),
['u'] = HANDLER_NORM(stats_uptime, false, NULL),
['U'] = HANDLER_NORM(stats_shared, false, "oper:general"),
['v'] = HANDLER_NORM(stats_servers, false, NULL),
['V'] = HANDLER_NORM(stats_servers, false, NULL),
['x'] = HANDLER_NORM(stats_tgecos, false, "oper:general"),
@ -1095,85 +1093,6 @@ stats_uptime (struct Client *source_p)
Count.totalrestartcount);
}
struct shared_flags
{
int flag;
char letter;
};
static struct shared_flags shared_flagtable[] =
{
{ SHARED_PKLINE, 'K' },
{ SHARED_TKLINE, 'k' },
{ SHARED_UNKLINE, 'U' },
{ SHARED_PXLINE, 'X' },
{ SHARED_TXLINE, 'x' },
{ SHARED_UNXLINE, 'Y' },
{ SHARED_PRESV, 'Q' },
{ SHARED_TRESV, 'q' },
{ SHARED_UNRESV, 'R' },
{ SHARED_LOCOPS, 'L' },
{ SHARED_REHASH, 'H' },
{ SHARED_TDLINE, 'd' },
{ SHARED_PDLINE, 'D' },
{ SHARED_UNDLINE, 'E' },
{ SHARED_GRANT, 'G' },
{ SHARED_DIE, 'I' },
{ 0, '\0'}
};
static void
stats_shared (struct Client *source_p)
{
struct remote_conf *shared_p;
rb_dlink_node *ptr;
char buf[sizeof(shared_flagtable)/sizeof(shared_flagtable[0])];
char *p;
int i;
RB_DLINK_FOREACH(ptr, shared_conf_list.head)
{
shared_p = ptr->data;
p = buf;
*p++ = 'c';
for(i = 0; shared_flagtable[i].flag != 0; i++)
{
if(shared_p->flags & shared_flagtable[i].flag)
*p++ = shared_flagtable[i].letter;
}
*p = '\0';
sendto_one_numeric(source_p, RPL_STATSULINE,
form_str(RPL_STATSULINE),
shared_p->server, shared_p->username,
shared_p->host, buf);
}
RB_DLINK_FOREACH(ptr, cluster_conf_list.head)
{
shared_p = ptr->data;
p = buf;
*p++ = 'C';
for(i = 0; shared_flagtable[i].flag != 0; i++)
{
if(shared_p->flags & shared_flagtable[i].flag)
*p++ = shared_flagtable[i].letter;
}
*p = '\0';
sendto_one_numeric(source_p, RPL_STATSULINE,
form_str(RPL_STATSULINE),
shared_p->server, "*", "*", buf);
}
}
/* stats_servers()
*

View file

@ -215,11 +215,6 @@ handle_remote_xline(struct Client *source_p, int temp_time, const char *name, co
{
struct ConfItem *aconf;
if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name,
(temp_time > 0) ? SHARED_TXLINE : SHARED_PXLINE))
return;
if(!valid_xline(source_p, name, reason))
return;
@ -447,10 +442,6 @@ me_unxline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
static void
handle_remote_unxline(struct Client *source_p, const char *name)
{
if(!find_shared_conf(source_p->username, source_p->host,
source_p->servptr->name, SHARED_UNXLINE))
return;
remove_xline(source_p, name, false);
}