3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +01:00

relay: allow dropping messages from user-less clients

This adds two new options, both defaulting to True:
- relay:accept_weird_senders (global)
- servers:<name>:relay_weird_senders (per-server)

Closes #404.
This commit is contained in:
James Lu 2017-02-24 19:16:01 -08:00
parent 3d9f69dba7
commit c03f2d772c
2 changed files with 16 additions and 0 deletions

View File

@ -337,6 +337,12 @@ servers:
# entire PyLink service than what's desired, even when PyLink is only connected as a bot. # entire PyLink service than what's desired, even when PyLink is only connected as a bot.
track_oper_statuses: false track_oper_statuses: false
# Determines whether messages from unknown clients (servers, clients not sharing in a -n
# channel, etc.) should be forwarded via the PyLink server. If this is disabled, these
# messages will be silently dropped. This overrides the "accept_weird_senders" option in the
# "relay:" configuration block, and defaults to True for consistency with older releases.
#relay_weird_senders: false
# Plugins to load (omit the .py extension) # Plugins to load (omit the .py extension)
plugins: plugins:
# Commands plugin: Provides simple commands for things like checking login # Commands plugin: Provides simple commands for things like checking login
@ -573,6 +579,11 @@ relay:
# #
#clientbot_modesync: none #clientbot_modesync: none
# Determines whether messages from unknown clients (servers, clients not sharing in a -n channel,
# etc.) should be forwarded via the PyLink server. If this is disabled, these messages will be
# silently dropped. This defaults to True for consistency with older releases.
#accept_weird_senders: false
#servprotect: #servprotect:
# This block configures the servprotect plugin; you don't need this if you aren't using it. # This block configures the servprotect plugin; you don't need this if you aren't using it.

View File

@ -1079,6 +1079,11 @@ def handle_messages(irc, numeric, command, args):
user = get_remote_user(irc, remoteirc, numeric, spawn_if_missing=False) user = get_remote_user(irc, remoteirc, numeric, spawn_if_missing=False)
if not user: if not user:
if not (irc.serverdata.get('relay_weird_senders',
conf.conf.get('relay', {}).get('accept_weird_senders', True))):
log.debug("(%s) Dropping message for %s from user-less sender %s", irc.name,
real_target, numeric)
continue
# No relay clone exists for the sender; route the message through our # No relay clone exists for the sender; route the message through our
# main client (or SID for notices). # main client (or SID for notices).