mirror of
https://github.com/pissnet/pissircd.git
synced 2025-08-16 07:01:35 +01:00
Allow SVS* commands to be sent by non-ulined servers by default,
this is needed by various future JSON-RPC calls. See https://www.unrealircd.org/docs/Set_block#set::limit-svscmds
This commit is contained in:
parent
62d62c4e88
commit
7d9dcb5e0a
17 changed files with 35 additions and 16 deletions
|
@ -53,6 +53,8 @@ typedef enum BanTarget { BAN_TARGET_IP=1, BAN_TARGET_USERIP=2, BAN_TARGET_HOST=3
|
|||
|
||||
typedef enum HideIdleTimePolicy { HIDE_IDLE_TIME_NEVER=1, HIDE_IDLE_TIME_ALWAYS=2, HIDE_IDLE_TIME_USERMODE=3, HIDE_IDLE_TIME_OPER_USERMODE=4 } HideIdleTimePolicy;
|
||||
|
||||
typedef enum LimitSVSCMDS { LIMIT_SVSCMDS_SERVERS=0, LIMIT_SVSCMDS_ULINES=1 } LimitSVSCMDS;
|
||||
|
||||
/** The set { } block configuration */
|
||||
typedef struct Configuration Configuration;
|
||||
struct Configuration {
|
||||
|
@ -171,6 +173,7 @@ struct Configuration {
|
|||
char *sasl_server;
|
||||
int server_notice_colors;
|
||||
int server_notice_show_event;
|
||||
LimitSVSCMDS limit_svscmds;
|
||||
};
|
||||
|
||||
extern MODVAR Configuration iConf;
|
||||
|
|
|
@ -496,6 +496,7 @@ typedef enum ClientStatus {
|
|||
#define IsTLS(x) ((x)->flags & CLIENT_FLAG_TLS)
|
||||
#define IsSecure(x) ((x)->flags & CLIENT_FLAG_TLS)
|
||||
#define IsULine(x) ((x)->flags & CLIENT_FLAG_ULINE)
|
||||
#define IsSvsCmdOk(x) (((x)->flags & CLIENT_FLAG_ULINE) || ((iConf.limit_svscmds == LIMIT_SVSCMDS_SERVERS) && IsServer((x))))
|
||||
#define IsVirus(x) ((x)->flags & CLIENT_FLAG_VIRUS)
|
||||
#define IsIdentLookupSent(x) ((x)->flags & CLIENT_FLAG_IDENTLOOKUPSENT)
|
||||
#define SetIdentLookup(x) do { (x)->flags |= CLIENT_FLAG_IDENTLOOKUP; } while(0)
|
||||
|
|
15
src/conf.c
15
src/conf.c
|
@ -7941,6 +7941,12 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce)
|
|||
if (!strcmp(cepp->name, "policy"))
|
||||
tempiConf.hide_idle_time = hideidletime_strtoval(cepp->value);
|
||||
}
|
||||
} else if (!strcmp(cep->name, "limit-svscmds"))
|
||||
{
|
||||
if (!strcmp(cep->value, "ulines"))
|
||||
tempiConf.limit_svscmds = LIMIT_SVSCMDS_ULINES;
|
||||
else
|
||||
tempiConf.limit_svscmds = LIMIT_SVSCMDS_SERVERS;
|
||||
} else
|
||||
{
|
||||
int value;
|
||||
|
@ -9286,6 +9292,15 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(cep->name, "limit-svscmds"))
|
||||
{
|
||||
CheckNull(cep);
|
||||
if (strcmp(cep->value, "servers") && strcmp(cep->value, "ulines"))
|
||||
{
|
||||
config_error("%s:%i: set::limit-svscmds: value must be one of: 'servers' or 'ulines'",
|
||||
cep->file->filename, cep->line_number);
|
||||
errors++;
|
||||
}
|
||||
} else
|
||||
{
|
||||
int used = 0;
|
||||
|
|
|
@ -63,7 +63,7 @@ CMD_FUNC(cmd_svsjoin)
|
|||
{
|
||||
Client *target;
|
||||
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
return;
|
||||
|
||||
if ((parc < 3) || !(target = find_user(parv[1], NULL)))
|
||||
|
|
|
@ -73,7 +73,7 @@ CMD_FUNC(cmd_svskill)
|
|||
if (parc == 3)
|
||||
comment = parv[2];
|
||||
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
return;
|
||||
|
||||
if (!(target = find_user(parv[1], NULL)))
|
||||
|
|
|
@ -64,7 +64,7 @@ MOD_UNLOAD()
|
|||
*/
|
||||
CMD_FUNC(cmd_svslusers)
|
||||
{
|
||||
if (!IsULine(client) || parc < 4)
|
||||
if (!IsSvsCmdOk(client) || parc < 4)
|
||||
return;
|
||||
if (hunt_server(client, NULL, "SVSLUSERS", 1, parc, parv) == HUNTED_ISME)
|
||||
{
|
||||
|
|
|
@ -326,7 +326,7 @@ void do_svsmode(Client *client, MessageTag *recv_mtags, int parc, const char *pa
|
|||
int what;
|
||||
long oldumodes = 0;
|
||||
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
return;
|
||||
|
||||
what = MODE_ADD;
|
||||
|
|
|
@ -62,7 +62,7 @@ CMD_FUNC(cmd_svsmotd)
|
|||
{
|
||||
FILE *conf = NULL;
|
||||
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
{
|
||||
sendnumeric(client, ERR_NOPRIVILEGES);
|
||||
return;
|
||||
|
|
|
@ -67,7 +67,7 @@ CMD_FUNC(cmd_svsnick)
|
|||
char nickname[NICKLEN+1];
|
||||
char oldnickname[NICKLEN+1];
|
||||
|
||||
if (!IsULine(client) || parc < 4 || (strlen(parv[2]) > NICKLEN))
|
||||
if (!IsSvsCmdOk(client) || parc < 4 || (strlen(parv[2]) > NICKLEN))
|
||||
return; /* This looks like an error anyway -Studded */
|
||||
|
||||
if (hunt_server(client, NULL, "SVSNICK", 1, parc, parv) != HUNTED_ISME)
|
||||
|
|
|
@ -112,14 +112,14 @@ CMD_FUNC(cmd_svsnline)
|
|||
AddListItem(bconf, conf_ban);
|
||||
}
|
||||
|
||||
if (IsULine(client))
|
||||
if (IsSvsCmdOk(client))
|
||||
sendto_server(client, 0, 0, NULL, ":%s SVSNLINE + %s :%s",
|
||||
client->id, parv[2], parv[3]);
|
||||
break;
|
||||
}
|
||||
case '-':
|
||||
{
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
return;
|
||||
if (parc < 3)
|
||||
return;
|
||||
|
@ -146,7 +146,7 @@ CMD_FUNC(cmd_svsnline)
|
|||
}
|
||||
case '*':
|
||||
{
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
return;
|
||||
wipe_svsnlines();
|
||||
sendto_server(client, 0, 0, NULL, ":%s SVSNLINE *", client->id);
|
||||
|
|
|
@ -59,7 +59,7 @@ void do_svsnolag(Client *client, int parc, const char *parv[], int show_change)
|
|||
Client *target;
|
||||
char *cmd = show_change ? MSG_SVS2NOLAG : MSG_SVSNOLAG;
|
||||
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
return;
|
||||
|
||||
if (parc < 3)
|
||||
|
|
|
@ -59,7 +59,7 @@ CMD_FUNC(cmd_svsnoop)
|
|||
{
|
||||
Client *acptr;
|
||||
|
||||
if (!(IsULine(client) && parc > 2))
|
||||
if (!(IsSvsCmdOk(client) && parc > 2))
|
||||
return;
|
||||
|
||||
if (hunt_server(client, NULL, "SVSNOOP", 1, parc, parv) == HUNTED_ISME)
|
||||
|
|
|
@ -54,7 +54,7 @@ CMD_FUNC(cmd_svso)
|
|||
const char *snomask;
|
||||
const char *vhost;
|
||||
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
return;
|
||||
|
||||
if ((parc < 8) || BadPtr(parv[7]))
|
||||
|
|
|
@ -63,7 +63,7 @@ CMD_FUNC(cmd_svspart)
|
|||
{
|
||||
Client *target;
|
||||
const char *comment = (parc > 3 && parv[3] ? parv[3] : NULL);
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
return;
|
||||
|
||||
if (parc < 3 || !(target = find_user(parv[1], NULL)))
|
||||
|
|
|
@ -62,7 +62,7 @@ CMD_FUNC(cmd_svssilence)
|
|||
char *p, *cp, c;
|
||||
char request[BUFSIZE];
|
||||
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
return;
|
||||
|
||||
if (parc < 3 || BadPtr(parv[2]) || !(target = find_user(parv[1], NULL)))
|
||||
|
|
|
@ -67,7 +67,7 @@ void do_svssno(Client *client, int parc, const char *parv[], int show_change)
|
|||
Client *target;
|
||||
int what = MODE_ADD, i;
|
||||
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
return;
|
||||
|
||||
if (parc < 2)
|
||||
|
|
|
@ -62,7 +62,7 @@ CMD_FUNC(cmd_svswatch)
|
|||
{
|
||||
Client *target;
|
||||
|
||||
if (!IsULine(client))
|
||||
if (!IsSvsCmdOk(client))
|
||||
return;
|
||||
|
||||
if (parc < 3 || BadPtr(parv[2]) || !(target = find_user(parv[1], NULL)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue