3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 11:42:51 +01:00

changehost: explicitly forbid $host from being expanded

This will cause recursion whenever applyhost is ran and a user matches a mask based on real host or IP, which haven't changed. Any suffix or prefix applied to $host will be reapplied, often leading to invalid hosts that are too long.
This commit is contained in:
James Lu 2016-08-02 22:17:23 -07:00
parent 592ae4053e
commit 02b5f0b7e6
2 changed files with 5 additions and 2 deletions

View File

@ -370,7 +370,7 @@ changehost:
# This sets the hostmasks that Changehost should look for. Whenever someone
# with a matching nick!user@host connects, their host will be set to the
# text defined. The following substitutions are available here:
# $uid, $ts (time of connection), $nick, $realhost, $host, $ident, $ip.
# $uid, $ts (time of connection), $nick, $realhost, $ident, amd $ip.
# Invalid characters in hosts are replaced with a "-".
# Also, make sure you quote each entry so the YAML parser treats them as
# raw strings.

View File

@ -38,7 +38,10 @@ def _changehost(irc, target, args):
# Substitute using the fields provided the hook data. This means
# that the following variables are available for substitution:
# $uid, $ts, $nick, $realhost, $host, $ident, $ip
# $uid, $ts, $nick, $realhost, $ident, and $ip. $host is explicitly
# forbidden because it can cause recursive loops.
del args['host']
new_host = template.substitute(args)
# Replace characters that are not allowed in hosts with "-".