Commit Graph

194 Commits

Author SHA1 Message Date
Valentin Lorentz
e0fdcb67c0 Store IrcUser hostmasks in HostmaskSet to prevent their pattern cache from expiring
When the number of hostmasks exceeds 1000 (the hardcoded size of
_patternCache and _hostmaskPatternEqualCache), this triggers
a pathological case in the LRU caches, that causes all calls to be
a cache miss.
This means that on every IRC message received, ircdb.checkIgnored triggers
a recompilation of *all* user hostmasks, which is very expensive
computationally.

This commit stores them in their own cache to prevent them from
expiring.
2021-05-27 22:15:52 +02:00
Valentin Lorentz
1455a83391 Merge branch 'nopassword' into testing 2021-05-25 00:12:36 +02:00
Valentin Lorentz
d91303271d ircdb: Fix 'IrcUser.nicks' on non-lowercase network names
This dict was filled with IrcString keys, which is hashed
as lowercase, so when queried with a non-lowercase string,
the key would not be found, and lead to very confusing errors.
2021-05-24 17:21:57 +02:00
Valentin Lorentz
742f4f825d Add the option to disable password login.
Actually resolves GH-1140, finally.
2021-05-23 15:33:38 +02:00
Valentin Lorentz
903eceebda Simplify checkIgnored code from previous commit 2020-11-04 11:32:20 +01:00
Valentin Lorentz
76b5a42428 supybot.defaultIgnore shouldn't ignore registered users.
Even if they are not trusted. This fixes a regression in
97016b9c55.

This happens because 'user._checkCapability' raises a KeyError
when the user has neither this cap or the anticap; which was mistakenly
caught here by the 'except KeyError' expecting to catch non-existing
users.
(And that why 'try' blocks should be limited to as few lines as possible.)
2020-10-26 00:19:57 +01:00
Valentin Lorentz
97016b9c55 Exempt trusted users from being ignored.
Closes GH-66.
2020-09-05 16:42:28 +02:00
Valentin Lorentz
eead5566e5 utils.gen: set __slots__.
We create *a lot* of these structs, so it saves a considerable
amount of space.
2020-05-15 22:57:35 +02:00
Valentin Lorentz
0c6b526fdd Add -scheduler.repeat to default capabilities.
It's too easy to use to flood.
2020-05-13 20:16:35 +02:00
Valentin Lorentz
22120ee862 Fix various issues with STS handling. 2020-05-01 19:46:19 +02:00
Valentin Lorentz
51ff013fcc Apply STS policies when connecting to a server. 2020-05-01 19:46:19 +02:00
Valentin Lorentz
ecc2c32950 Add support for storing STS policies.
If on an insecure connection: reconnect.
If on a secure connect: store it and do nothing else.

For now, stored STS policies are not read when connecting to an
insecure server.
2020-05-01 19:46:19 +02:00
Valentin Lorentz
5e2343f717 Update doc of capabilities.default to mention 'channel capability setdefault'. 2019-11-08 20:53:04 +01:00
Valentin Lorentz
3c42ce0861 Only clear users db if the filename is set. 2019-09-28 10:33:54 +02:00
Valentin Lorentz
bcbaa979d5 Revert "Deduplicate (de)serialization code shared by UsersDictionary and ChannelsDictionary."
This reverts commit a4f8e3f647.
2019-09-28 10:33:10 +02:00
Valentin Lorentz
a4f8e3f647 Deduplicate (de)serialization code shared by UsersDictionary and ChannelsDictionary. 2019-09-26 22:48:05 +02:00
Valentin Lorentz
bf7db13f01 Disallow mutating commands in Aka/Alias/Scheduler by default.
It's too easy to abuse these commands when owners don't know they have to set
the appropriate anticapabilities; so let's set the anticapabilities by default.
2019-07-31 23:00:55 +02:00
Valentin Lorentz
1ac7812d7a Use __slots__ for core config values. 2018-09-25 18:59:46 +02:00
James Lu
8981b225f1 ircdb: fix typo in supybot.capabilities.registeredUsers description 2018-01-06 10:39:05 -08:00
Valentin Lorentz
b9a159b68a Add supybot.capabilities.registeredUsers, to give default capabilities to all registered users. 2018-01-05 19:24:54 +01:00
Valentin Lorentz
d656db454d User: if '@hostmask add' detects a conflict and the caller is the owner, tell them who the conflicting user is. 2017-12-30 18:47:09 +01:00
Valentin Lorentz
dab026169f Use ast.literal_eval() instead of eval() when possible.
It's unlikely to change anything, but a little more safety
does not hurt.
2017-02-25 13:10:33 +01:00
Valentin Lorentz
11496b4bbb ircdb: When serializing, do not write a 'password' command if there is no password set.
Having a 'password' command with no password stops the unserialization for that user.

May be a first step toward allowing users with no password (GH-1140).
2016-02-07 10:49:17 +01:00
Valentin Lorentz
17b1ae2dd5 Prevent 'dictionary changed size during iteration'. 2015-09-02 15:00:29 +00:00
Valentin Lorentz
912d2e1538 core: Apply some suggestions of pyflakes. 2015-08-31 18:19:22 +02:00
Valentin Lorentz
c3a2c800f1 Remove need for 2to3. 2015-08-11 16:50:23 +02:00
Valentin Lorentz
f305ff3c02 Remove fix_basestring. 2015-08-10 20:24:11 +02:00
Valentin Lorentz
be118c3338 Remove use of fix_dict fixer. 2015-08-08 23:08:49 +02:00
Valentin Lorentz
f85395d8b1 Revert ban description-related commits.
Squashed commit of the following:

commit ea4743caa8bdc7abba99635898ae09a9497c43d3
Author: Valentin Lorentz <progval@progval.net>
Date:   Sun May 24 01:07:49 2015 +0200

    Revert "Channel & core: Add support for ban descriptions. Closes GH-1092."

    This reverts commit 6efea561a5.

    Conflicts:
    	src/ircdb.py

commit d43b9229fe926869852c4abda1da1b18a0093938
Author: Valentin Lorentz <progval@progval.net>
Date:   Sun May 24 01:06:30 2015 +0200

    Revert "Fix import of channel database."

    This reverts commit 8ed5522da0.

commit 6c453d9acb3dc37711cb4d51abd9fe216ca65c08
Author: Valentin Lorentz <progval@progval.net>
Date:   Sun May 24 01:06:27 2015 +0200

    Revert "Fix previous commit."

    This reverts commit 394f1554f7.
2015-05-24 01:08:54 +02:00
Valentin Lorentz
394f1554f7 Fix previous commit. 2015-05-23 21:18:50 +02:00
Valentin Lorentz
8ed5522da0 Fix import of channel database. 2015-05-23 21:00:05 +02:00
Valentin Lorentz
f1fae13b4a core: Fix IrcChannel.preserve. Closes GH-1106. 2015-05-16 03:59:36 +02:00
Valentin Lorentz
6efea561a5 Channel & core: Add support for ban descriptions. Closes GH-1092. 2015-05-15 13:43:26 +02:00
Valentin Lorentz
4470805b5f core: Remove useless imports. 2015-03-03 09:02:29 +01:00
Valentin Lorentz
77e6de6bba Fix errors detected by PyLint. 2014-03-05 14:14:36 +01:00
Valentin Lorentz
59ae6f987d ircdb: Honor ignoreDefaultAllow for unknown users too. 2014-02-27 19:05:19 +00:00
Valentin Lorentz
a7f750d273 Fix compatibility with Python 2.6 (does not support the set syntax). 2014-01-26 21:14:21 +01:00
Valentin Lorentz
1fbdedc7e0 Continue accelerating the 2to3 step (remove fix_funcattrs, fix_itertools, and fix_itertools_imports). 2014-01-21 10:50:55 +01:00
Valentin Lorentz
ca419f6485 Continue accelerating the 2to3 step (remove fix_reduce, fix_renames, fix_repr, fix_set_literal, fix_standarderror, fix_sys_exc, fix_throw, and fix_tuple_params). 2014-01-20 16:04:53 +01:00
Valentin Lorentz
bb7db3ab21 Continue accelerating the 2to3 step (remove fix_except). 2014-01-20 15:49:15 +01:00
Valentin Lorentz
2fda69b4d6 Continue accelerating the 2to3 step (remove fix_raise). 2014-01-20 15:43:55 +01:00
Valentin Lorentz
c1c23f66f4 Continue accelerating the 2to3 step (remove fix_print). 2014-01-20 15:31:09 +01:00
Valentin Lorentz
4652c9ce51 Start accelerating the 2to3 step (remove fix_apply, fix_buffer, fix_callable, fix_exec, fix_execfile, fix_exitfunc, fix_filter, fix_funcattrs, fix_future, fix_getcwdu, and fix_has_key). 2014-01-20 14:49:47 +01:00
Valentin Lorentz
566e841977 Update documentation of ircdb.checkCapability (used in the Sphinx doc). 2014-01-20 11:35:28 +01:00
Valentin Lorentz
233571e4b5 Add arguments ignoreChannelOp and ignoreDefaultAllow to ircdb.checkCapability. 2013-12-27 15:04:32 +00:00
Valentin Lorentz
657b76d174 Fix merge. 2013-09-22 20:29:52 +02:00
Valentin Lorentz
990b911c06 Merge remote-tracking branch 'supybot/master' into testing
Conflicts:
	src/callbacks.py
	src/ircdb.py
2013-09-22 20:16:20 +02:00
James McCoy
6361b1e856 ircdb: Deduplicate hostmasks in IrcUser.addAuth
If addAuth is called with a hostmask that already exists (exactly, not
just equivalent patterns) in self.auth, remove the entry for the old
authentication.  This essentially updates the timeout for the hostmask.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2013-09-22 11:13:52 -04:00
Valentin Lorentz
4e2962b39e Fix error when writing hostmask-collision error message. 2013-09-17 13:32:52 +00:00
Valentin Lorentz
40675ffdfa Merge remote-tracking branch 'supybot/master' into testing
Conflicts:
	plugins/Admin/plugin.py
	plugins/BadWords/config.py
	plugins/Filter/plugin.py
	plugins/Google/plugin.py
	plugins/Math/plugin.py
	plugins/Misc/plugin.py
	plugins/Note/plugin.py
	plugins/RSS/plugin.py
	plugins/Seen/test.py
	plugins/ShrinkUrl/config.py
	plugins/ShrinkUrl/plugin.py
	plugins/ShrinkUrl/test.py
	plugins/Status/plugin.py
	plugins/String/config.py
	plugins/String/plugin.py
	plugins/Time/plugin.py
	plugins/Todo/plugin.py
	plugins/Web/plugin.py
	plugins/__init__.py
	scripts/supybot-botchk
	setup.py
	src/__init__.py
	src/callbacks.py
	src/commands.py
	src/conf.py
	src/drivers/Socket.py
	src/ircdb.py
	src/irclib.py
	src/ircutils.py
	src/questions.py
	src/registry.py
	src/schedule.py
	src/test.py
	src/utils/file.py
	src/utils/gen.py
	src/utils/net.py
	src/utils/web.py
	src/world.py
2013-08-24 11:28:29 +02:00