Commit Graph

440 Commits

Author SHA1 Message Date
Valentin Lorentz
45ff70907f [WIP] Start reworking Irc around a FSM.
To keep track of connection state instead of a complex implicit flow
between handling functions.
2020-05-01 19:43:27 +02:00
Valentin Lorentz
e7553dcca4 Add subcommand dispatching for CAP/FAIL/WARN/NOTE. 2020-01-23 14:25:10 +01:00
Valentin Lorentz
c4d073a9be Rename doAuthenticate* functions to not conflict with callback names. 2020-01-23 14:24:41 +01:00
Valentin Lorentz
ac07b440dc Rewrite ecdsa-nist256p-challenge using python-cryptography instead of python-ecdsa.
Which is more secure. Closes GH-1389.

It also fixes the protocol/format to use the same one as Atheme.
See also: 8a81224ba8
2020-01-01 12:07:59 +01:00
Valentin Lorentz
1ed47f802f Request msgid capability. 2019-12-05 21:11:35 +01:00
Valentin Lorentz
2dddfefa98 Fix log on SASL failure.
Broken by 04b55805b8.
2019-11-09 18:38:40 +01:00
Valentin Lorentz
6a9462be00 Fix reset of capabilities_ls.
Broken by 0014b206ad.
2019-11-09 18:27:07 +01:00
Valentin Lorentz
04b55805b8 Log SASL mechanism on failure. Closes GH-1014. 2019-11-02 20:52:58 +01:00
Valentin Lorentz
9268356e97 Split 'CAP REQ' commands to not exceed 512 bytes. 2019-10-25 23:07:31 +02:00
Valentin Lorentz
0014b206ad Reset capability set state on reconnection. 2019-10-25 22:40:51 +02:00
Valentin Lorentz
cfbbed3da9 Truncate incoming lines to 512-2, not 500. 2019-10-25 22:31:09 +02:00
Valentin Lorentz
84c1f1572d Don't temporarily set msg.channel to invalid values.
This causes issue when multiple command threads deal with the same message.
2019-09-20 21:25:32 +02:00
Valentin Lorentz
c1ae3f5c81 all plugins: Use msg.channel instead of msg.args[0] + give network name to self.registryValue. 2019-08-24 23:35:01 +02:00
Valentin Lorentz
8bb31a54e7 Strip statusmsg chars in core to determine the actual channel.
Use msg.channel if relevant, otherwise strip them locally.
2019-08-24 14:52:59 +02:00
Valentin Lorentz
5b40b5136d Limit statusmsg prefix stripping to PRIVMSG and NOTICE. 2019-08-18 10:09:11 +02:00
Valentin Lorentz
7a7cdb9f05 Add a 'channel' attribute to IrcMsg objects.
It's nicer to use 'irc.channel' instead of 'irc.args[0]', and .channel
provides the actual channel name (stripped of the statusmsg prefix),
so it can be used by plugins when they want to use the actual channel
name.
2019-08-17 22:23:51 +02:00
Valentin Lorentz
696254ff1b Use irc.isChannel instead of ircutils.isChannel when possible.
It's aware of the network's 'chantypes'.
2019-08-04 21:52:40 +02:00
Valentin Lorentz
76699ec063 Add support for 'message-tags' capability, to receive TAGMSGs. 2019-05-08 21:19:53 +02:00
Valentin Lorentz
624553c069 irclib: Don't return the same nick twice when duplicates in supybot.nick.alternates + supybot.nick.
It migt crash on: 'assert newNick != self.nick'
2019-01-27 09:10:06 +01:00
Valentin Lorentz
c433f05190 Add a config var to require SASL auth when connecting. 2018-09-10 22:48:49 +02:00
Valentin Lorentz
7e98802809 Drop STARTTLS support, it complicates the connection initialization too much. 2018-01-24 09:27:39 +01:00
Nicolas Coevoet
2b030ac178 more arguments added for WHOX, to avoid external plugins recall same requests 2018-01-23 19:37:19 +01:00
Valentin Lorentz
40b9bbcb1b Send 'AUTHENTICATE :+' at the end of a SCRAM auth.
https://github.com/ircv3/ircv3-specifications/pull/326
2018-01-14 22:53:40 +01:00
Valentin Lorentz
bdbc79bfc6 Fix for Slack. 2017-08-23 18:51:54 +02:00
Valentin Lorentz
b00081f6c9 Make REMOVE a high-priority message. Closes GH-1294. 2017-08-03 22:02:01 +02:00
Valentin Lorentz
8ce43110b6 Working support of scram-sha-256. 2017-01-11 00:10:46 +01:00
Valentin Lorentz
9be4db01f8 Fix ecdsa nameerror introduced in previous commit. 2017-01-10 23:27:50 +01:00
Valentin Lorentz
e87ad5b5a3 Untested implementation of SASL SCRAM auth. 2017-01-10 23:23:56 +01:00
James Lu
278a111f5f irclib: expand standard substitutions in realname 2016-08-16 11:00:58 +02:00
Valentin Lorentz
b33dadea9e Make INFO a bit less verbose when connecting. 2016-02-21 11:01:31 +01:00
Valentin Lorentz
fee97c0308 irclib: Tag AWAY messages with channel names. 2016-01-09 10:10:41 +00:00
Valentin Lorentz
4b1c766b42 Add support for STARTTLS (not tested). 2015-12-12 16:40:48 +01:00
Valentin Lorentz
30cb10e422 Add support for CAP NEW, including reauthentication. 2015-12-12 00:52:44 +01:00
Valentin Lorentz
834453eeff Request capability.
We don't do anything with it, but plugins might use it.
2015-12-11 23:32:57 +01:00
Valentin Lorentz
8aff8170e4 Filter list of SASL mechanisms when provided (908 or IRCv3.2-style CAP LS). 2015-12-11 23:30:57 +01:00
Valentin Lorentz
45c23a8f54 Try all possible SASL mechanisms instead of just one. 2015-12-11 10:56:05 +01:00
Valentin Lorentz
15d59d1153 Handle AUTHENTICATE line splitting. 2015-12-10 20:08:53 +01:00
Valentin Lorentz
3b78fd2424 Tag NICK messages with the channel as for QUIT messages. 2015-12-04 13:27:11 +01:00
Valentin Lorentz
d2749ea4d6 Add support for BATCH. 2015-12-04 01:37:23 +01:00
Valentin Lorentz
f880229d78 Tag QUIT messages with the list of channels the user was on. 2015-12-04 01:14:42 +01:00
James Lu
1168b4d0b7 irclib: handle disconnections correctly for InspIRCd 2.0 networks
The old code, which checked for "Closing Link" in the message, wouldn't have matched InspIRCd's way of closing connections (they send "Closing link" with a lowercase l):

DEBUG 2015-09-27T19:15:32 Incoming message (overdrive-irc): ERROR :Closing link: (LilyBot@0::1) [Quit: test]
2015-09-27 19:32:26 -07:00
Valentin Lorentz
aa13ac88ea Also send CAP END if no capability is requested. 2015-09-05 13:14:05 +02:00
Valentin Lorentz
f86e25d9fb Prevent authentication hanging if the server supports no capability the bot asks. 2015-09-05 12:43:43 +02:00
Valentin Lorentz
912d2e1538 core: Apply some suggestions of pyflakes. 2015-08-31 18:19:22 +02:00
Valentin Lorentz
943c8bc495 Add support for IRCv3.2 extension chghost. 2015-08-22 20:48:03 +02:00
Valentin Lorentz
73ed9635b5 Add support for IRCv3.2 subcommand CAP DEL. 2015-08-22 20:25:39 +02:00
Valentin Lorentz
b338a23708 core: Use IRCv3.2 extension server-time to fill IrcMsg.time, if available. 2015-08-22 20:11:46 +02:00
Valentin Lorentz
33e8966e4b ChannelLogger & core: Use IRCv3.2 extension invite-notify if available. 2015-08-22 18:24:32 +02:00
Valentin Lorentz
6ee24517cb Fix 9c8f05bc16. 2015-08-22 14:25:20 +02:00
Valentin Lorentz
9c8f05bc16 Use IRCv3.2 extension userhost-in-names if available. 2015-08-22 10:33:59 +02:00
Valentin Lorentz
9dd2811950 Split capabilities into a string, as it should be done. 2015-08-22 10:17:32 +02:00
Valentin Lorentz
c3a2c800f1 Remove need for 2to3. 2015-08-11 16:50:23 +02:00
Valentin Lorentz
be118c3338 Remove use of fix_dict fixer. 2015-08-08 23:08:49 +02:00
James Lu
c3ddc585b4 irclib: fix error when SASL is supported but not enabled for a network 2015-06-12 18:07:27 -07:00
nyuszika7h
869c6ce30d Fix capability negotiation 2015-06-12 15:08:45 +02:00
Valentin Lorentz
cf557b516a Fix Python 2.6 support. 2015-05-24 12:29:11 +02:00
Valentin Lorentz
e2b3b917e5 Use CAP LS. 2015-05-24 12:25:42 +02:00
Valentin Lorentz
a2004b7150 Improve order of connect messages. 2015-05-17 12:31:14 +02:00
Valentin Lorentz
5bd0001d02 irclib: Faster connection. (At least 5 seconds less.) 2015-05-17 12:02:31 +02:00
Valentin Lorentz
b405f998a5 NickAuth: Add support for account-tag (not tested). 2015-05-15 20:46:18 +02:00
Valentin Lorentz
259457ae2f core: Request capability metadata-notify so plugins can use it if they want. 2015-05-15 19:35:51 +02:00
Valentin Lorentz
59d542bb70 NickCapture & core: Add support for MONITOR. Closes GH-842. 2015-05-15 19:24:24 +02:00
Valentin Lorentz
487f8c8af5 Merge remote-tracking branch 'supybot/master' into testing
Conflicts:
	.mailmap
	README
	docs/FAQ.rst
	plugins/Ctcp/plugin.py
	plugins/Misc/plugin.py
	plugins/Network/plugin.py
	plugins/QuoteGrabs/plugin.py
	plugins/RSS/README.txt
	plugins/Relay/plugin.py
	plugins/ShrinkUrl/config.py
	plugins/ShrinkUrl/plugin.py
	plugins/ShrinkUrl/test.py
	setup.py
	src/callbacks.py
	src/commands.py
	src/conf.py
	test/test_commands.py
2015-05-15 14:41:08 +02:00
Valentin Lorentz
7448c04760 Store the list of server capabilities in IrcState. 2015-05-15 13:01:26 +02:00
James McCoy
cffbd959e8
Add handling of 437 (nick temporarily unavailable) errors
Servers bind a nick to a connection for a short window after it
disappears to try and avoid contention over nicks.  This may cause a 437
during connection to a server (c.f. ProgVal/Limnoria#1033) or even
during normal nick changes, if the timing is lucky.

Add handling for this error to the startup code and the Admin plugin.

Signed-off-by: James McCoy <vega.james@gmail.com>
2015-03-26 01:33:04 -04:00
Valentin Lorentz
4470805b5f core: Remove useless imports. 2015-03-03 09:02:29 +01:00
James Lu
561085cbd1 irclib.py: fix an encoding error with Python 3 and SASL ECDSA-NIST256P-CHALLENGE
Closes ProgVal#1028.
2015-01-24 13:32:13 -05:00
nyuszika7h
5653e0c727 Fix commit 30a026a
Requesting multiple capabilities in one message will result in a NAK for
all of them if at least one is not supported by the server.
2015-01-19 18:12:39 +01:00
Valentin Lorentz
30a026a92a Request multi-prefix capability. (GH-1017) 2015-01-19 17:15:25 +01:00
nyuszika7h
bf418756a9 Fix registration timeout when SASL is refused
https://github.com/ProgVal/Limnoria/issues/854#issuecomment-70414650
2015-01-18 21:31:03 +01:00
Max Teufel
ef0a2c1cb1 irclib: add support for SASL ECDSA-NIST256P-CHALLENGE
Closes #911
2014-12-29 11:47:57 +01:00
nyuszika7h
18ccc168f5 src/irclib.py: fix typo causing an error on 904 2014-08-30 11:55:31 +02:00
nyuszika7h
414d2d1878 Add support for SASL EXTERNAL 2014-08-27 12:21:22 +02:00
Valentin Lorentz
0c6315afac Merge pull request #808 from nyuszika7h/fix-who
Fix WHO clash with external plugins (e.g. ChanTracker)
2014-08-05 12:00:31 +02:00
nyuszika7h
037cc98cac Fix capability negotiation 2014-08-05 11:22:56 +02:00
nyuszika7h
da817603dd src/irclib.py: use a set instead of a list for Irc.caps 2014-08-04 21:54:44 +02:00
nyuszika7h
581d167e5e src/irclib.py: set caps in Irc.__init__
This allows other plugins to request capabilities in a straightforward
way.
2014-08-04 21:36:00 +02:00
nyuszika7h
20c71df8f9 Fix WHO clash with external plugins (e.g. ChanTracker) 2014-08-04 21:32:13 +02:00
Valentin Lorentz
9385487f54 Simplify and fix logic of umodes filtering. Closes GH-719. 2014-08-04 16:26:23 +02:00
nyuszika7h
ddbfad5086 Add do352 back for IRCds which do not support WHOX 2014-08-03 13:58:49 +02:00
nyuszika7h
dd5556ea99 Fix previous commit 2014-08-02 14:11:49 +02:00
nyuszika7h
e185416987 Fix tests 2014-08-02 13:45:41 +02:00
nyuszika7h
871607614a Implement account-notify, extended-join and WHOX
Also integrate it with NickAuth.

Closes #778.
2014-08-02 12:30:24 +02:00
nyuszika7h
32e3be3dac src/irclib.py: remove some errors 2014-07-26 11:52:34 +02:00
nyuszika7h
100ff648be src/irclib.py: Further improvements to SASL and a few other minor things 2014-05-24 17:25:32 +02:00
nyuszika7h
414249c9ac src/irclib.py: Delay sending SASL authstring until given green light
That means wait until receiving 'AUTHENTICATE +' from the server, which
means the mechanism is supported and we can proceed to send the
authstring.

It generally works anyway, but it's better to follow the standards, plus
old versions of elemental-ircd may crash if we don't do this.
2014-05-24 15:57:27 +02:00
Valentin Lorentz
9d084e2e70 Allow network-specific username and ident. Closes GH-589. 2014-05-08 08:33:01 +00:00
nyuszika7h
822e6449f9 irclib: Add support for additional SASL numerics 2014-04-10 15:03:20 +02:00
nyuszika7h
6be8204805 irclib: Remove some useless SASL debug messages 2014-04-10 14:57:20 +02:00
nyuszika7h
14e51f6193 irclib: Make SASL messages easier to understand
The logs are meant to be understandable by humans, and not everyone
might know AUTHENTICATE is a SASL command.

[ci skip]
2014-04-10 14:53:17 +02:00
Valentin Lorentz
0d4784cf4a Fix compatibility with Python 2.6 (does not support the set syntax). 2014-01-26 21:49:28 +01:00
Valentin Lorentz
35a62b4e77 Continue accelerating the 2to3 step (remove fix_ws_comma, fix_xreadlines, and fix_zip). 2014-01-21 10:40:18 +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
529b8f8d99 Continue accelerating the 2to3 step (remove fix_nonzero, fix_operator, and fix_paren). 2014-01-20 15:19:06 +01:00
Valentin Lorentz
677f7fdd6f irclib: Prevent crash if 324 or 329 is not received after any other post-join messages. 2013-10-10 14:10:06 +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
Valentin Lorentz
9bfec720f5 Fix traceback if bot is kicked immediately after joining a channel. 2013-07-13 12:01:53 +02:00
Milos Petkovic
be6116f958 Reset network uptime on reconnection as well 2013-06-17 08:09:16 +02:00
Valentin Lorentz
1090c4623f Factoids: Add supybot.plugins.Factoids.requireVoice. Closes GH-378. 2013-05-17 17:47:43 +02:00