Commit Graph

854 Commits

Author SHA1 Message Date
Simon Ser
0cd18a78db Unify BOUNCER ADDNETWORK and CHANGENETWORK 2021-10-29 15:51:13 +02:00
Simon Ser
de38d93085 Always reply ERR_SASLABORTED on SASL abort
Some clients (Hexchat) always expect AUTHENTICATE * to succeed with
ERR_SASLABORTED even if SASL hasn't been started.
2021-10-28 11:29:34 +02:00
Simon Ser
9ec1f1a5b0 Add context args to Database interface
This is a mecanical change, which just lifts up the context.TODO()
calls from inside the DB implementations to the callers.

Future work involves properly wiring up the contexts when it makes
sense.
2021-10-18 19:15:15 +02:00
Simon Ser
4be6c4b19c Remove unnecessary downstream cap checks
downstreamConn.SendMessage already performs this cap checking.
2021-10-18 09:20:11 +02:00
Simon Ser
1507e88b36 Remove incorrect AWAY TODO in downstreamConn.SendMessage
PRIVMSG/NOTICE get RPL_AWAY, not AWAY.
2021-10-18 09:08:52 +02:00
Simon Ser
324d0fb0ac Unify away-notify and account-notify handling 2021-10-17 21:54:18 +02:00
Simon Ser
455fef2421 Add support for account-notify 2021-10-17 21:54:18 +02:00
Simon Ser
2f495e9768 Remove unused REGISTRATION_IS_COMPLETED in handleMessageUnregistered
downstreamConn.handleMessageUnregistered is only called when the
user isn't registered.
2021-10-16 11:42:32 +02:00
Simon Ser
ade59beb8c Send BOUNCER REGISTRATION_IS_COMPLETED error 2021-10-16 11:41:37 +02:00
Hubert Hirtz
350057e60b Set hard timeouts on DB transactions 2021-10-15 22:39:14 +02:00
Simon Ser
2ce97bcc12 msgstore_fs: rename log dir when network is renamed 2021-10-15 18:11:04 +02:00
Simon Ser
b1d89163f8 ci: switch to alpine/latest
We don't need the bleeding edge.
2021-10-15 09:59:53 +02:00
Simon Ser
04d671121c msgstore_fs: add reference to ZNC 2021-10-14 20:51:03 +02:00
Alexey Yerin
3109340651 downstream: handle name=... in BOUNCER 2021-10-14 16:03:14 +02:00
Simon Ser
28e1ca51e7 db_postgres: remove unnecessary DEFAULT NULL in schema 2021-10-14 10:09:01 +02:00
Simon Ser
d334bb18a2 db_postgres: use tx for all queries in StoreClientDeliveryReceipts 2021-10-13 19:15:50 +02:00
Simon Ser
79dbb20f98 db_postgres: quote table name in StoreClientDeliveryReceipts 2021-10-13 17:38:20 +02:00
Simon Ser
2ed4491c17 Don't strip spaces at start of MOTD
This breaks ASCII art. Instead, just drop the final newline if any.
2021-10-13 12:53:43 +02:00
Simon Ser
a9a066faac Add bouncer MOTD
Closes: https://todo.sr.ht/~emersion/soju/137
2021-10-13 10:58:34 +02:00
Simon Ser
ca9fa9198c db_postgres: fix constraints errors
Stop using ON CONFLICT DO UPDATE.

Closes: https://todo.sr.ht/~emersion/soju/138
2021-10-13 10:12:14 +02:00
Hubert Hirtz
eb41ed4171 db_postgres: handle both constraints on network updates
Closes: https://todo.sr.ht/~emersion/soju/138
2021-10-13 08:53:49 +02:00
Simon Ser
d646ffc9d6 contrib/clients: update IRCv3 caps for Weechat 3.3 2021-10-12 21:49:06 +02:00
Simon Ser
c8aba6286f doc.soju.1: fix typo and improve formatting for "certfp generate" 2021-10-12 21:34:25 +02:00
Simon Ser
8ef2de196d doc/soju.1: add descriptions for all flags for "user create" 2021-10-12 21:31:12 +02:00
Simon Ser
96f8751e3d doc/soju.1: use angle-brackets for URL
Helps a bit terminal emulators to recognize the link.
2021-10-12 21:27:48 +02:00
Simon Ser
e55d0d7552 Stop sending RPL_CREATED
There's no point in sending this numeric if it doesn't contain any
useful info.
2021-10-12 19:28:44 +02:00
Simon Ser
8a0400c5cc msgstore_fs: fix ListTargets error on missing log dir
Initially, before connecting to the network, the log dir will be
empty. Return an empty list of chat history targets in this case.
2021-10-12 17:36:00 +02:00
Simon Ser
6e8b6fa153 Fix printf formatting in error message 2021-10-12 17:36:00 +02:00
Simon Ser
5c20c4c0f4 Upgrade dependencies 2021-10-12 16:54:51 +02:00
Simon Ser
4e9ddf78ab service: allow updating other users 2021-10-12 09:11:14 +02:00
Simon Ser
96d4111be2 ci: run PostgreSQL tests 2021-10-11 16:06:37 +02:00
Simon Ser
1cd99ce2f7 Fix unused imports in tests 2021-10-11 16:01:50 +02:00
Simon Ser
2b8691ff40 Run server test with PostgreSQL too 2021-10-11 15:57:37 +02:00
Simon Ser
2b23828842 db_postgres: add migration test 2021-10-11 15:55:07 +02:00
Hubert Hirtz
6e06663615 PostgreSQL support 2021-10-11 15:21:04 +02:00
Simon Ser
a4f631f3e3 db_sqlite: add migration test 2021-10-11 12:26:51 +02:00
Hubert Hirtz
3a171607e0 Correctly send back PRIVMSGs and NOTICEs to self 2021-10-10 12:05:41 +02:00
Hubert Hirtz
d4b7bb02da Send back TAGMSGs to self 2021-10-10 12:05:41 +02:00
Hubert Hirtz
0fd81f38fa Dismiss TAGMSGs directed to BouncerServ 2021-10-10 12:05:40 +02:00
Simon Ser
5a2d6246ec Add "server notice" command 2021-10-08 10:52:03 +02:00
Simon Ser
e3b4687ac7 Split CertFP logic into separate file 2021-10-08 09:47:25 +02:00
Simon Ser
81782fefe8 build: don't clobber config file
Use `test -f` instead of `cp -n`, because the former is POSIX.

References: https://github.com/emersion/soju/pull/32
2021-10-08 09:11:31 +02:00
Simon Ser
94dbfff11d Add max-user-networks config option 2021-10-07 20:43:10 +02:00
Simon Ser
9f021ba9a9 doc/soju.1: mention that accept-proxy-ip affects PROXY proto 2021-10-07 20:04:20 +02:00
Alex Karle
8951760733 chathistory: Fix truncated backlog due to timezones
Because msgstore_fs writes logs in localtime, the CHATHISTORY timestamps
(UTC) must be converted to localtime prior to filtering ranges ensure
the right range is sent back to the client.

Prior to this patch, the iteration back from the BEFORE time failed to
load the hours between midnight UTC and midnight localtime in each day's
logged messages. This is because the final time to be considered in a
day's log file (the "start" time) reuses the previous start time's
locale:

    start = time.Date(year, month, day, 0, 0, 0, 0, start.Location()).Add(-1)

By converting the original start and end from the CHATHISTORY commands
to localtime in Load*Time and ListTargets, we ensure we read through
midnight each day.
2021-10-07 11:57:42 +02:00
Simon Ser
1d56ef19e7 Add WHOIS reply for BouncerServ 2021-10-06 11:50:12 +02:00
Simon Ser
2814512da7 msgstore_fs: add limit on number of opened files 2021-10-06 11:41:39 +02:00
Simon Ser
e177977c30 Add DB stats 2021-10-05 19:31:06 +02:00
Simon Ser
5405923aa2 Add limit for RSA bits 2021-10-05 19:21:43 +02:00
Simon Ser
f93616fb41 Add "server status" command
Right now, it prints the number of active users and number of
downstream connections.
2021-10-05 19:13:53 +02:00