Commit Graph

11631 Commits

Author SHA1 Message Date
Valentin Lorentz
d919e2133d Poll: Initial commit with basic features. 2021-06-19 16:44:21 +02:00
Valentin Lorentz
3b25a94b46 Regenerate READMEs. 2021-06-19 16:44:21 +02:00
Valentin Lorentz
2293d1c129 Services: Update to the latest version of the draft/account-registration spec. 2021-06-15 20:35:55 +02:00
Clark Boylan
67a39a3adb
Fix joins to many channels (#1473)
* Fix joins to many channels

If you have enough channels that the 512 byte message limit on the JOIN
message is hit then limnoria was losing the channel that put it over the
limit and not including it in the next JOIN message. This resulted in
losing one channel for every JOIN message that pushed us over 512 bytes.

We fix this by generating the JOIN message immediately after resetting
the channels list to ensure we include the channel that pushed us over
the limit. Then the next time through our JOIN msg construction we'll
add subsequent channels without forgetting the one that pushed us over.

* Add test for channel join lists

This adds a test for the issue that is fixed in the previous commit. We
ensure that when JOINs are split over multiple messages we JOIN to all
channels that were part of the input list and don't forget any of them.
2021-06-14 23:15:43 +02:00
Valentin Lorentz
4b82934131 Services: Add @nickserv and @chanserv command, to message services directly
This is because the recommended method ('owner ircquote nickserv register mypassword bot@example.com')
does not work on charybdis, as Limnoria inserts a colon
before the trailing argument and Charybdis' m_alias module
does not parse commands using the IRC syntax, so it
considers the leading colon to be part of the email address.

The alternative would be to change the recommended command to:
'owner ircquote PRIVMSG nickserv :register mypassword bot@example.com'
but it is prone to typos, so I think we should avoid it.
2021-06-14 21:47:36 +02:00
Valentin Lorentz
c8053dad54 Socket: Silence TLS warning for Tor hidden services.
They are already end-to-end encrypted and don't need TLS.
2021-06-12 21:03:15 +02:00
Valentin Lorentz
69c948bd5f irclib: fix _getTarget when to= is given and self.private=True 2021-06-08 21:56:42 +02:00
Valentin Lorentz
8a52902727 irclib: Fix overhead computation by using the real target computation algo 2021-06-08 21:56:08 +02:00
Valentin Lorentz
225c249ec2 irclib: Fix crash on SASL authentication failure 2021-06-05 15:50:05 +02:00
Valentin Lorentz
ac4083e710 README: Synchronize description with the website. 2021-06-05 10:29:21 +02:00
Valentin Lorentz
aaca81c5b9 drivers: Fix log message when the STS policy uses the same port as configured. 2021-06-02 16:51:09 +02:00
Valentin Lorentz
a4758146d8 Factoids: Fix NameErrors in HTTP callback. 2021-06-01 12:16:34 +02:00
Valentin Lorentz
4caf35f94b Dunno: Document command substitution 2021-06-01 10:43:05 +02:00
Mattia Rizzolo
a0b1334034 increase the timeout for Fediverse's tests
At least in Debian CI they routinely timeout when they run in the
busiest server.

Signed-off-by: Mattia Rizzolo <mattia@mapreri.org>
2021-06-01 08:58:56 +02:00
Valentin Lorentz
43aada5b33 Store ignored hostmasks in Expiring HostmaskSet to prevent their pattern cache from expiring too soon
See e0fdcb67c0 for the rationale
(tl;dr: prevents triggering a degenerate case of the LRU cache when
there are over 1000 ignore masks)
2021-05-30 19:35:05 +02:00
Valentin Lorentz
698dfc2fca httpserver: Hide well-known callback from the index
Closes GH-1460.
2021-05-29 11:44:22 +02:00
Valentin Lorentz
2e2c243b8b RSS: Remove flaky test 2021-05-28 19:37:37 +02:00
Valentin Lorentz
b8852eb9f3 RSS: Fix nondeterministic test failure 2021-05-28 19:15:56 +02:00
Valentin Lorentz
758f9bee34 RSS: Catch errors from update_feed(), just in case
feedparser should always catch the error, but someone reported it doesn't
catch this error on TLS cert issues:

```
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/supybot/plugins/RSS/plugin.py", line 86, in newf
    f(*args, **kwargs)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/supybot/plugins/RSS/plugin.py", line 351, in update_feeds
    self.update_feed_if_needed(feed)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/supybot/plugins/RSS/plugin.py", line 337, in update_feed_if_needed
    self.update_feed(feed)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/supybot/plugins/RSS/plugin.py", line 311, in update_feed
    d = feedparser.parse(feed.url, etag=feed.etag,
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/feedparser/api.py", line 214, in parse
    data = _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, result)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/feedparser/api.py", line 114, in _open_resource
    return http.get(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, result)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/feedparser/http.py", line 158, in get
    f = opener.open(request)
  File "/usr/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 1393, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib/python3.8/urllib/request.py", line 1354, in do_open
    r = h.getresponse()
  File "/usr/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
```

So let's catch the error just in case, so it doesn't block all other
feeds.
2021-05-28 18:48:35 +02:00
Valentin Lorentz
3415cd08a1 RSS: Add test checking exception from a feed doesn't affect other feeds. 2021-05-28 18:38:06 +02:00
Valentin Lorentz
7c68b2cb53 RSS: Fix crash in @rss list 2021-05-28 17:56:59 +02:00
Valentin Lorentz
86b1741fdd Fix nondeterministic test on Python < 3.7. 2021-05-27 22:36:27 +02:00
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
a5cd870bd2 irclib: Refactor hostmaskPatternEqual to expose compileHostmaskPattern.
This clarifies the code a bit.

And I want to store compiled patterns in ircdb.User in a future
commit, so they can outlive the LRU cache.
2021-05-27 21:36:43 +02:00
Valentin Lorentz
711db72ad0 Socket: Fix crash non-TLS connections when using a SOCKS proxy 2021-05-27 01:08:33 +02:00
Valentin Lorentz
3bedc86479 Socket: Disable resolution when using a SOCKS proxy
1. Avoids leaking DNS queries
2. necessary for onion services
2021-05-27 00:08:02 +02:00
Valentin Lorentz
cca1156b90 drivers: Log SOCKS proxy on connecting 2021-05-26 23:43:23 +02:00
Valentin Lorentz
c3f39fc93b callbacks, Misc, Relay: Fix when the message prefix is just a nick
<user> and <host> are optional in https://datatracker.ietf.org/doc/html/rfc1459#section-2.3.1

Closes GH-1451.
2021-05-26 17:50:29 +02:00
Valentin Lorentz
e59e0f6908 irclib: Fix target computation
It mistakenly used the bot's nick as target when the message is in private,
so 'more' after a private message always answered the user did not send
a command before (because said command was attributed to the bot)
2021-05-26 00:30:27 +02:00
Valentin Lorentz
710d16f301 Admin: Fix python 3.4 support. 2021-05-25 19:24:21 +02:00
fa3707ed66 src/conf.py: add :port to explanation of networks.X.socksproxy 2021-05-25 18:58:35 +02:00
Valentin Lorentz
fd97f78f93 Admin: Fix @acmd 2021-05-25 09:22:24 +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
04facade82 Move official channel from Freenode to Libera.Chat 2021-05-22 18:51:54 +02:00
Valentin Lorentz
14e637f4af SedRegex: Fix NameError in config setup 2021-05-22 18:51:35 +02:00
Valentin Lorentz
fb16e8b6c2 Network: Fix IPv6 parsing 2021-05-22 18:51:22 +02:00
Valentin Lorentz
7af8918f41 Channel: Fix Nameerror in @alert.
Closes GH-1452
2021-05-17 18:24:37 +02:00
Valentin Lorentz
8559ea9848 httpserver: Fix pointless tracebacks
because doGet does not accept the 'form' argument
2021-05-17 18:24:21 +02:00
Valentin Lorentz
db99332079 callback: Fix AssertionError when action is given with implicit noLengthCheck 2021-05-07 20:10:57 +02:00
Valentin Lorentz
e3fce56800 Relay: Don't relay QUIT/NICK if the sender isn't in the relayed channel. 2021-05-03 20:02:33 +02:00
Valentin Lorentz
ca369afe59 Relay: Send the right network in the display name (was dest instead of source) 2021-05-02 18:34:49 +02:00
Valentin Lorentz
fc2e34956e Relay: Implement +draft/display-name specification.
https://github.com/ircv3/ircv3-specifications/pull/452
2021-05-02 17:14:20 +02:00
Valentin Lorentz
97a7aa304e RSS: Make @remove completely clean up feeds 2021-05-01 14:29:09 +02:00
Valentin Lorentz
556bd788b5 RSS: Default to setting announces per channel+network, instead of just per channel
The default behavior was to announce feeds on all channels with the same name,
which is rarely what was expected.
Instead, this limits it to the current network.
2021-05-01 13:31:34 +02:00
Valentin Lorentz
435f8de73a RSS: Fix bug in @remove that prevented it from fully deleting aliased feeds. 2021-05-01 13:27:56 +02:00
Valentin Lorentz
e96633c1e3 RSS: Forbid dots in feed names.
They confuse the registry
2021-04-28 20:04:58 +02:00
David Macek
3d21c7cbcb Services: Keep per-network state separate
Until now, only `waitingJoins` was stored separately per network, while
`channels`, `sentGhost` and `identified` had one common value per plugin
instance.  Instead of making everything a dictionary indexed by network
name like `waitingJoins`, let's bundle all the state together in a class
and store *its* instances in such a dictionary.

This fixes at least one race condition, for which a test case was added.
Even with `noJoinsUntilIdentified` set, the bot would let joins through
as long as *any* one network has already finished identifying.
2021-04-27 19:52:58 +02:00
Valentin Lorentz
177c20267c irclib: Fix crash caused by 4d2efc65ef.
dynamicScope inspects the stack looking for this variable, so we need to keep it.
2021-04-24 21:21:57 +02:00