mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 09:19:23 +01:00
nefarious: don't drop messages without a sender
During the initial link phase, the uplink server isn't even known. It sends "SERVER blah blah" and "PASS :whatever" as is.
This commit is contained in:
parent
74af9b67ba
commit
a12b2cb5dc
@ -266,9 +266,8 @@ class P10Protocol(Protocol):
|
|||||||
protocol modules, coersing various sender prefixes from nicks and server names to P10
|
protocol modules, coersing various sender prefixes from nicks and server names to P10
|
||||||
"numeric nicks", whenever possible.
|
"numeric nicks", whenever possible.
|
||||||
|
|
||||||
Per the P10 specification, commands sent without an explicit sender prefix are treated
|
Commands sent without an explicit sender prefix are treated as originating from the uplink
|
||||||
as originating from the uplink server if they are SQUIT or KILL messages. Otherwise, they
|
server.
|
||||||
are silently ignored.
|
|
||||||
"""
|
"""
|
||||||
data = data.split(" ")
|
data = data.split(" ")
|
||||||
args = self.parseArgs(data)
|
args = self.parseArgs(data)
|
||||||
@ -291,16 +290,9 @@ class P10Protocol(Protocol):
|
|||||||
elif sender_uid in self.irc.users:
|
elif sender_uid in self.irc.users:
|
||||||
# Sender is a user (converting from name to UID gave a valid result).
|
# Sender is a user (converting from name to UID gave a valid result).
|
||||||
sender = self._getUid(sender)
|
sender = self._getUid(sender)
|
||||||
elif command_token in ('SQ', 'SQUIT', 'D',' KILL'):
|
|
||||||
# From https://github.com/evilnet/nefarious2/blob/a29b63144/doc/p10.txt#L142:
|
|
||||||
# if the source does not exist: if the command is SQUIT or KILL (or short token), the
|
|
||||||
# line must be parsed anyway, with the directly linked server from which the message
|
|
||||||
# came as the source. otherwise the line must be ignored.
|
|
||||||
sender = self.uplink
|
|
||||||
else:
|
else:
|
||||||
log.debug("(%s) Ignoring message '%s' with bad sender '%s'.", self.irc.name,
|
# No sender prefix; treat as coming from uplink IRCd.
|
||||||
args, args[0])
|
sender = self.irc.uplink
|
||||||
return
|
|
||||||
|
|
||||||
args = args[2:]
|
args = args[2:]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user