From c1dbfdab48f5b6359c0f054096c299c7803425fc Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 23 Aug 2019 21:22:28 -0700 Subject: [PATCH] classes, clientbot: don't allow _get_UID in parse_modes to create new users --- classes.py | 2 +- protocols/clientbot.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/classes.py b/classes.py index 7dea015..a0705fb 100644 --- a/classes.py +++ b/classes.py @@ -929,7 +929,7 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore): log.debug('Mode %s: This mode is a prefix mode.', mode) arg = args.pop(0) # Convert nicks to UIDs implicitly - arg = self._get_UID(arg) + arg = self._get_UID(arg) or arg if arg not in self.users: # Target doesn't exist, skip it. log.debug('(%s) Skipping setting mode "%s %s"; the ' 'target doesn\'t seem to exist!', self.name, diff --git a/protocols/clientbot.py b/protocols/clientbot.py index d361d42..cd57948 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -31,7 +31,7 @@ class ClientbotBaseProtocol(PyLinkNetworkCoreWithUtils): # Remove conf key checks for those not needed for Clientbot. self.conf_keys -= {'recvpass', 'sendpass', 'sid', 'sidrange', 'hostname'} - def _get_UID(self, nick, ident=None, host=None, spawn_new=True): + def _get_UID(self, nick, ident=None, host=None, spawn_new=False): """ Fetches the UID for the given nick, creating one if it does not already exist and spawn_new is True. @@ -477,7 +477,7 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol): except ValueError: ident = host = None # Set ident and host as null for now. nick = sender # Treat the sender prefix we received as a nick. - idsource = self._get_UID(nick, ident, host) + idsource = self._get_UID(nick, ident, host, spawn_new=True) if idsource in self.users: # Handle IRCv3.2 account-tag. @@ -719,7 +719,7 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol): # Get the PUID for the given nick. If one doesn't exist, spawn # a new virtual user. - idsource = self._get_UID(nick, ident=ident, host=host) + idsource = self._get_UID(nick, ident=ident, host=host, spawn_new=True) # Queue these virtual users to be joined if they're not already in the channel, # or we're waiting for a kick acknowledgment for them.