Skip registering passwords too long for one IRC line

The irctest controller's registerUser sends NickServ REGISTER as a single
PRIVMSG, so a password that overflows the 512-byte line limit gets
truncated on the wire and can never match a later SASL login. Raise
NotImplementedByController for those, like the reference services
controllers, so such cases skip instead of failing spuriously.
This commit is contained in:
Jean Chevronnet 2026-07-12 00:52:56 +00:00
parent e5c15421c8
commit 172e50c748
No known key found for this signature in database

View file

@ -15,8 +15,10 @@ real network. See https://github.com/progval/irctest
""" """
import os import os
import shutil import shutil
from typing import Type from typing import Optional, Type
import irctest.cases
import irctest.runner
from irctest.basecontrollers import BaseServicesController, DirectoryBasedController from irctest.basecontrollers import BaseServicesController, DirectoryBasedController
CONFIG = """\ CONFIG = """\
@ -52,6 +54,22 @@ class FedservController(BaseServicesController, DirectoryBasedController):
self.proc = self.execute([binary, "config.toml"], cwd=self.directory) self.proc = self.execute([binary, "config.toml"], cwd=self.directory)
def registerUser(
self,
case: irctest.cases.BaseServerTestCase,
username: str,
password: Optional[str] = None,
) -> None:
# NickServ REGISTER is a single PRIVMSG, so a password that would push
# the line past the 512-byte IRC limit can't be registered intact. Like
# the reference services controllers, skip rather than silently truncate.
assert password
if len(password.encode()) > 400:
raise irctest.runner.NotImplementedByController(
"Passwords too long to REGISTER in a single IRC message"
)
super().registerUser(case, username, password)
def get_irctest_controller_class() -> Type[FedservController]: def get_irctest_controller_class() -> Type[FedservController]:
return FedservController return FedservController