1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-07 01:23:12 +02:00

Updated labeled-response: drop the draft/ prefix now that the specification

is ratified and also fix a serious flood bug in the implementation.
Oh, and move the loadmodule line to the correct place in modules.default.conf.
This commit is contained in:
Bram Matthys
2020-02-08 08:09:53 +01:00
parent de44549996
commit febc4a45f3
4 changed files with 32 additions and 50 deletions
+9 -5
View File
@@ -3,6 +3,12 @@ UnrealIRCd 5.0.3 Release Notes
UnrealIRCd 5.0.3
-----------------
Fixes:
* Fix serious flood issue in labeled-response implementation.
* An IRCOp SQUIT'ing a far remote server may cause a broken link topology
* In channels that are +D (delayed join), PARTs were not shown correctly to
channel operators.
Enhancements:
* A new HISTORY command for history playback (```HISTORY #channel number-of-lines```)
which allows you to fetch more lines than the on-join history playback.
@@ -13,12 +19,10 @@ Enhancements:
```unrealircd.org/userip``` and ```unrealircd.org/userhost```
which communicate the user@ip and real user@host to IRCOps.
Fixes:
* An IRCOp SQUIT'ing a far remote server may cause a broken link topology
* In channels that are +D (delayed join), PARTs were not shown correctly to
channel operators.
Changes:
* Drop the draft/ prefix now that the IRCv3
[labeled-response](https://ircv3.net/specs/extensions/labeled-response.html)
specification is out of draft.
* The operclass permission ```immune:target-limit``` is now called
```immune:max-concurrent-conversations```, since it bypasses
[set::anti-flood::max-concurrent-conversations](https://www.unrealircd.org/docs/Set_block#set::anti-flood::max-concurrent-conversations).
+1 -1
View File
@@ -205,6 +205,7 @@ loadmodule "plaintext-policy"; /* plaintext-policy announce */
loadmodule "server-time"; /* adds server timestamp to various messages */
loadmodule "sts"; /* strict transport policy (set::tls::sts-policy) */
loadmodule "echo-message"; /* shows clients if their messages are altered/filtered */
loadmodule "labeled-response"; /* correlate requests and responses easily */
/*** Other ***/
@@ -224,6 +225,5 @@ loadmodule "rmtkl"; /* Easily remove *-Lines in bulk with /RMTKL */
loadmodule "restrict-commands"; /* Provides set::restrict-commands settings */
loadmodule "reputation"; /* used by Connthrottle and others, see next */
loadmodule "connthrottle"; /* see https://www.unrealircd.org/docs/Connthrottle */
loadmodule "labeled-response"; /* currently in draft - loaded here to get it tested*/
loadmodule "userip-tag"; /* unrealircd.org/userip-tag for ircops */
loadmodule "userhost-tag"; /* unrealircd.org/userhost-tag for ircops */
+11 -4
View File
@@ -93,10 +93,17 @@ CMD_FUNC(cmd_batch)
if (MyConnect(target) && !IsServer(target) && !HasCapability(target, "batch"))
return;
/* Relay the batch message to the client (or server) */
parv[1] = "BATCH";
concat_params(buf, sizeof(buf), parc, parv);
sendto_prefix_one(target, client, recv_mtags, "%s", buf);
if (MyUser(target))
{
/* Send the batch message to the client */
parv[1] = "BATCH";
concat_params(buf, sizeof(buf), parc, parv);
sendto_prefix_one(target, client, recv_mtags, ":%s %s", client->name, buf);
} else {
/* Relay the batch message to the server */
concat_params(buf, sizeof(buf), parc, parv);
sendto_prefix_one(target, client, recv_mtags, ":%s BATCH %s", client->name, buf);
}
}
/** This function verifies if the client sending
+11 -40
View File
@@ -39,7 +39,6 @@ struct LabeledResponseContext {
char batch[BATCHLEN+1]; /**< The generated batch id */
int responses; /**< Number of lines sent back to client */
int sent_remote; /**< Command has been sent to remote server */
int version; /**< Which version? Zero for official, non-zero is draft */
char firstbuf[4096]; /**< First buffered response */
};
@@ -84,11 +83,11 @@ MOD_INIT()
memset(&currentcmd, 0, sizeof(currentcmd));
memset(&cap, 0, sizeof(cap));
cap.name = "draft/labeled-response-0.2";
cap.name = "labeled-response";
c = ClientCapabilityAdd(modinfo->handle, &cap, &CAP_LABELED_RESPONSE);
memset(&mtag, 0, sizeof(mtag));
mtag.name = "draft/label";
mtag.name = "label";
mtag.is_ok = labeled_response_mtag_is_ok;
mtag.clicap_handler = c;
MessageTagHandlerAdd(modinfo->handle, &mtag);
@@ -115,12 +114,13 @@ int lr_pre_command(Client *from, MessageTag *mtags, char *buf)
memset(&currentcmd, 0, sizeof(currentcmd));
labeled_response_inhibit = labeled_response_inhibit_end = labeled_response_force = 0;
if (IsServer(from))
return 0;
for (; mtags; mtags = mtags->next)
{
if ((!strcmp(mtags->name, "draft/label") || !strcmp(mtags->name, "label")) && mtags->value)
if (!strcmp(mtags->name, "label") && mtags->value)
{
if (!strcmp(mtags->name, "draft/label"))
currentcmd.version = -1;
strlcpy(currentcmd.label, mtags->value, sizeof(currentcmd.label));
currentcmd.client = from;
break;
@@ -130,30 +130,6 @@ int lr_pre_command(Client *from, MessageTag *mtags, char *buf)
return 0;
}
char *labeled_response_tag_type(int version)
{
if (version == 0)
return "label";
else
return "draft/label";
}
char *labeled_response_batch_type(int version)
{
if (version == 0)
return "labeled-response";
else
return "draft/labeled-response";
}
char *labeled_response_message_tag(int version)
{
if (version == 0)
return "label";
else
return "draft/label";
}
char *gen_start_batch(void)
{
static char buf[512];
@@ -163,21 +139,17 @@ char *gen_start_batch(void)
if (MyConnect(currentcmd.client))
{
/* Local connection */
snprintf(buf, sizeof(buf), "@%s=%s :%s BATCH +%s %s",
labeled_response_message_tag(currentcmd.version),
snprintf(buf, sizeof(buf), "@label=%s :%s BATCH +%s labeled-response",
currentcmd.label,
me.name,
currentcmd.batch,
labeled_response_batch_type(currentcmd.version));
currentcmd.batch);
} else {
/* Remote connection: requires intra-server BATCH syntax */
snprintf(buf, sizeof(buf), "@%s=%s :%s BATCH %s +%s %s",
labeled_response_message_tag(currentcmd.version),
snprintf(buf, sizeof(buf), "@label=%s :%s BATCH %s +%s labeled-response",
currentcmd.label,
me.name,
currentcmd.client->name,
currentcmd.batch,
labeled_response_batch_type(currentcmd.version));
currentcmd.batch);
}
return buf;
}
@@ -222,8 +194,7 @@ int lr_post_command(Client *from, MessageTag *mtags, char *buf)
int more_tags = currentcmd.firstbuf[0] == '@';
currentcmd.client = NULL; /* prevent lr_packet from interfering */
snprintf(packet, sizeof(packet),
"@%s=%s%s%s\r\n",
labeled_response_tag_type(currentcmd.version),
"@label=%s%s%s\r\n",
currentcmd.label,
more_tags ? ";" : " ",
more_tags ? currentcmd.firstbuf+1 : currentcmd.firstbuf);