1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-15 04:28:09 -04:00
Commit Graph

983 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
3200c381db Rename to "/capability enter" and "/capability status".
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
2017-07-29 23:52:23 +01:00
Edward Tomasz Napierala
d5d45c29b8 Add capability mode error/success messages.
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
2017-07-29 23:52:23 +01:00
Edward Tomasz Napierala
56c94570b4 Implement /cap_enter.
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
2017-07-29 23:52:23 +01:00
Edward Tomasz Napierala
2914498b29 Consistency: use FALSE instead of 0.
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
2017-07-29 10:42:53 +01:00
Edward Tomasz Napierala
08dc6734b9 When rawlog open fails, there's no point in trying to write. Don't.
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
2017-07-29 10:40:42 +01:00
Edward Tomasz Napierala
42b5e89f6e Add missing diagnostics for rawlog open().
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
2017-07-28 04:49:14 +01:00
Edward Tomasz Napierala
e08e2bd87a Don't compute log_dir_create_mode in three different places.
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
2017-07-28 03:56:02 +01:00
Nei
f67e766934 Merge branch 'fix-11' into 'security'
Correct GHashTable usage

See merge request !16
2017-07-05 14:46:42 +00:00
Nei
fc3615120d Merge branch 'fix-10' into 'security'
Check return value of localtime

See merge request !15
2017-07-05 14:46:24 +00:00
ailin-nemui
73b851c39c correct GHashTable usage 2017-07-04 16:11:45 +02:00
ailin-nemui
1656dc1e54 Merge pull request #653 from ailin-nemui/regexex
Enable UTF8 in GRegex
2017-07-03 09:53:09 +02:00
Nei
29ebac987d Check return value of localtime
Fixes #10
2017-06-29 13:48:44 +00:00
dequis
7354a74c65 parse_time_interval: Allow negative time in settings
This splits sign parsing out of parse_time_interval_uint() so that the
negative sign is applied outside of the unsigned context where the
number parsing is done, and after all the checks that it's lower than
(1 << 31)

This fixes issues with settings like `server_reconnect_time`,
`server_connect_timeout` and `lag_max_before_disconnect`, which accepted
-1 as a valid value.
2017-06-17 15:34:36 -03:00
ailin-nemui
4edfccfce7 get rid of new_text 2017-06-05 13:46:43 +02:00
ailin-nemui
48899a123d Update iregex-gregex.c
add 2 comments about new_string
2017-06-05 10:23:16 +02:00
ailin-nemui
00354c3651 Update iregex-gregex.c
make helper functions static
2017-06-05 10:10:38 +02:00
ailin-nemui
79bbca4644 Refactor regex and implement UTF8 mode for GRegex
- with non-unicode byte to Private Use Area A mapping
- move all ifdefs to iregex.h file only
2017-06-04 00:52:53 +02:00
dequis
632b0ce5e6 Add parse_uint function to improve integer overflow handling
Originally found by oss-fuzz (issue 525) in get_ansi_color using ubsan.
After a lot of analysis I'm 99% sure this isn't security relevant so
it's fine to handle this publicly.

The fix is mainly adding a function that does it right and use it
everywhere. This is harder than it seems because the strtol() family of
functions doesn't have the friendliest of interfaces.

Aside from get_ansi_color(), there were other pieces of code that used
the same (out*10+(*in-'0')) pattern, like the parse_size() and
parse_time_interval() functions, which are mostly used for settings.
Those are interesting cases, since they multiply the parsed number
(resulting in more overflows) and they write to a signed integer
parameter (which can accidentally make the uints negative without UB)

Thanks to Pascal Cuoq for enlightening me about the undefined behavior
of parse_size (and, in particular, the implementation-defined behavior
of one of the WIP versions of this commit, where something like signed
integer overflow happened, but it was legal). Also for writing
tis-interpreter, which is better than ubsan to verify these things.
2017-05-18 00:21:11 -03:00
ailin-nemui
371eb7f505 expand macro 2017-05-12 16:27:33 +02:00
ailin-nemui
787e192567 improve nicklist performance 2017-05-12 13:36:48 +02:00
Joseph Bisch
a4cc4e0ad7
Fix off by one error with char_expandos 2017-03-31 15:37:48 -04:00
dequis
93c158d815 expand_escape: expand double backslash as a backslash 2017-03-08 20:01:05 -03:00
ailin-nemui
ddba68ad77 Merge pull request #659 from ailin-nemui/foreach_dontspam
make foreach send commands
2017-03-07 23:37:23 +01:00
ailin-nemui
62fd3ac180 Revert "Quote the filename when dcc requests are auto accepted." 2017-03-06 11:27:55 +01:00
ailin-nemui
29f27cfb39 Merge pull request #658 from LemonBoy/dcc-autoaccept
Quote the filename when dcc requests are auto accepted.
2017-03-04 21:43:21 +01:00
LemonBoy
dc99f8d7a5 Properly check the command arguments in tail place.
A command requiring an argument and given in tail position would not
raise an error but silently set the value to the empty string ''.
2017-03-04 21:37:13 +01:00
ailin-nemui
9aaa6449a0 make foreach send commands 2017-02-27 13:43:58 +01:00
LemonBoy
027acffb42 Handle file names with quotes.
Let's repurpose escape_string and make it more flexible by letting us
choose the characters to escape.
2017-02-22 11:49:09 +01:00
ailin-nemui
540639e0fa Merge pull request #627 from LemonBoy/ssl-expiry
Check whether the client certificate is expired.
2017-02-15 15:49:00 +01:00
LemonBoy
c067f8e99b Do not alias /server <hostname> to /server connect <hostname>
Closes #559.
2017-02-14 23:02:05 +01:00
ailin-nemui
653c7fb05a Merge pull request #622 from ailin-nemui/starttls
provide net_start_ssl api
2017-02-06 12:38:20 +01:00
ailin-nemui
28df637055 provide net_start_ssl api
fixes #615
2017-02-05 23:08:42 +01:00
LemonBoy
73e8a065bd Support OpenSSL 1.1.0.
- X509_get_notBefore becomes X509_get0_notBefore
- X509_get_notAfter becomes X509_get0_notAfter
- ASN1_STRING_data becomes ASN1_STRING_get0_data (and drops the const)
- The whole library is now initialized by OPENSSL_init_ssl

Closes #597
2017-02-03 13:29:19 +01:00
LemonBoy
697dd19d88 Check whether the client certificate is expired.
Right now we only warn the user, the connection keeps going.
Fixes #211
2017-01-22 21:58:55 +01:00
dequis
752f484c6c Add OPENSSL_NO_EC for solaris 11.3, see issue #598
Original patch by 'Slarky'

According to that ticket, the next major version of solaris won't need
this. Consider reverting this when solaris 11.3 stops being relevant.
2017-01-06 11:47:24 -03:00
ailin-nemui
33107be748 fix GRegex GError problem 2017-01-05 13:06:55 +01:00
Ailin Nemui
f5cbbebc2e switch for gregex and regex.h 2017-01-03 12:29:11 +01:00
LemonBoy
5dcf291f21 Use the RAW flag when building the regexps.
Also, plugged a memory leak when retrieving the match position.
2017-01-02 17:50:14 +01:00
LemonBoy
5eaead761f Rebase against master. 2017-01-02 17:50:14 +01:00
LemonBoy
3fcd3cd2b9 Remove the regexp_compiled field.
It was made redundant by the introduction of the pointer to the GRegex
structure.
Silence the compiler warning in textbuffer.c about preg being
initialized by setting it to NULL.
2017-01-02 17:50:14 +01:00
LemonBoy
8e5db471e4 Use GLib's regexp interface (backed by PCRE) 2017-01-02 17:50:14 +01:00
ailin-nemui
964f423fed Merge pull request #570 from josephbisch/fix-issue-563
enforce check that chatnets are nodelists to handle invalid config
2016-12-08 12:11:59 +01:00
Joseph Bisch
c98f5f23ea
enforce check that chatnets are nodelists to handle invalid config 2016-10-27 11:18:37 -04:00
Alexander Færøy
322625b548
Only do checks for SSL_get_server_tmp_key in network-openssl.c. 2016-10-22 22:04:33 +02:00
Alexander Færøy
0a6e66f8b7
Kill do { ... } while (0); and replace it with goto's. 2016-10-22 22:04:33 +02:00
Alexander Færøy
d501a54f4f
Emit the TLS handshake finished signal before we do verification.
This patch moves the emitted "tls handshake finished" signal to before
we do validation of the given TLS certificate. This ensures that we
display certificate information before we possibly error out and
disconnects from the server.
2016-10-22 22:04:33 +02:00
Alexander Færøy
5a04430998
Kill support for DANE.
This patch removes support for DANE validation of TLS certificates.

There wasn't enough support in the IRC community to push for this on the
majority of bigger IRC networks. If you believe this should be
reintroduced into irssi, then please come up with an implementation that
does not rely on the libval library. It is causing a lot of troubles for
our downstream maintainers.
2016-10-22 22:04:33 +02:00
Alexander Færøy
f533baa191
Lift EC_KEY declaration onto the entry of the function. 2016-10-22 22:04:32 +02:00
Alexander Færøy
25824e2d3f
Lift ASN1_STRING declaration onto the entry of the function. 2016-10-22 22:04:32 +02:00
Alexander Færøy
4e170c5233
Declare variables in the beginning of the function. 2016-10-22 22:04:32 +02:00
Alexander Færøy
53d772e48b
Make sure we clean-up after ourself upon failure. 2016-10-22 22:04:31 +02:00
Alexander Færøy
5146ce9631
Add x509 certificate and public key pinning support.
This patch adds two new options to /CONNECT and /SERVER to let the user
pin either an x509 certificate and/or the public key of a given server.

It is possible to fetch the certificate outside of Irssi itself to
verify the checksum. To fetch the certificate call:

    $ openssl s_client -connect chat.freenode.net:6697 < /dev/null 2>/dev/null | \
      openssl x509 > freenode.cert

This will download chat.freenode.net:6697's TLS certificate and put it into the
file freenode.cert.

-tls_pinned_cert
----------------

This option allows you to specify the SHA-256 hash of the x509
certificate. When succesfully connected to the server, irssi will verify
that the given server certificate matches the pin set by the user.

The SHA-256 hash of a given certificate can be verified outside of irssi
using the OpenSSL command line tool:

    $ openssl x509 -in freenode.cert -fingerprint -sha256 -noout

-tls_pinned_pubkey
------------------

This option allows you to specify the SHA-256 hash of the subject public key
information section of the server certificate. This section contains both the
cryptographic parameters for the public key, but also information about the
algorithm used together with the public key parameters.

When succesfully connected to the server, irssi will verify that the
given public key matches the pin set by the user.

The SHA-256 hash of a public key can be verified outside of irssi using
the OpenSSL command line tool:

    $ openssl x509 -in freenode.cert -pubkey -noout | \
      openssl pkey -pubin -outform der | \
      openssl dgst -sha256 -c | \
      tr a-z A-Z

It is possible to specify both -tls_pinned_cert and -tls_pinned_pubkey
together.
2016-10-22 22:01:50 +02:00
Alexander Færøy
1d101afe0d
s/SSL/TLS/ for warning strings. 2016-10-22 21:58:49 +02:00
Alexander Færøy
13f75d49e0
Simplify TLS verification error handling. 2016-10-22 21:58:49 +02:00
Alexander Færøy
b630fd1703
Populate and emit TLS_REC after TLS handshake have completed. 2016-10-22 21:58:49 +02:00
Alexander Færøy
99d017720d
Add TLS_REC.
This patch adds the TLS_REC structure. This structure is used to emit
information about the TLS handshake from the core of irssi to the
front-end layers such that we can display connection information to the
user.
2016-10-22 20:37:33 +02:00
Alexander Færøy
2be7289085
Rename SSL to TLS.
This patch changes the internal name of SSL to TLS. We also add -tls_*
options to /CONNECT and /SERVER, but make sure that the -ssl_* versions
of the commands continue to work like before.
2016-10-22 20:36:50 +02:00
Alexander Færøy
da67d3e8e6
Add function to convert a buffer to a colon-delimited hex string.
This patch adds binary_to_hex(), which can take an input buffer and
convert it to colon-delimited hex strings suitable for printing for
fingerprints.
2016-10-22 20:36:50 +02:00
Alexander Færøy
6300dfec71
Always build irssi with TLS support.
This patch removes the optional checks for whether to build irssi with
TLS support or not. This will allow us to ship a default configuration
file where we connect to TLS enabled IRC servers out of the box.
2016-10-16 14:55:48 +02:00
ailin-nemui
f9fd50a357 nullptr when doing module backward compat on invalid config 2016-09-25 23:17:20 +02:00
ailin-nemui
fd371cc345 Merge pull request #422 from LemonBoy/misc-cleanup
Clean up misc.c
2016-06-14 12:35:30 +02:00
LemonBoy
2da49e3ca6 Don't crash when the key isn't found. 2016-06-13 22:14:08 +02:00
ailin-nemui
52ced0728b Merge pull request #492 from LemonBoy/enum
Enum setting implementation
2016-06-13 21:47:39 +02:00
LemonBoy
439e21f127 Use ; as separator instead of , 2016-06-13 14:07:04 +02:00
LemonBoy
9a30ab53df Move the validation of the CHOICE setting value
Also, use a FORMAT to show the error message.
2016-06-13 14:03:00 +02:00
dequis
9ea155f8df servers-reconnect: pass unix_socket attribute to new connection
Trying to /reconnect unix sockets turned them into inet.
2016-06-12 20:28:06 -03:00
LemonBoy
6f795f020d Strip the surrounding whitespace. 2016-06-12 23:39:22 +02:00
LemonBoy
31f12c10df Use strarray_find instead of g_strv_contains 2016-06-12 16:38:34 +02:00
LemonBoy
bf9d9494db Add a CHOICE type to the settings system.
This is useful to let the user choose an option between a finite set of
valid alternatives.
2016-06-12 16:18:33 +02:00
ailin-nemui
d6d74c0da9 Do not crash on OPTCHAN when item has no server
May fix bugs.debian.org#826525
2016-06-06 16:58:40 +02:00
LemonBoy
98fce5f807 Deprecate net_connect() 2016-06-05 22:47:04 +02:00
LemonBoy
0060f682c2 Factor out some redundant code and remove hashtable_get_keys 2016-06-05 17:24:27 +02:00
LemonBoy
2e8744319d str_to_uofft is a tiny wrapper over strtoul{,l} 2016-06-05 16:54:20 +02:00
LemonBoy
e0b290c34f Update the g_istr_hash function to use the djb hash 2016-06-05 16:24:55 +02:00
LemonBoy
0f9d2b3570 Remove unused regexp_match 2016-06-05 16:24:55 +02:00
LemonBoy
7a3c6fe86c Replace strarray_length with g_strv_length 2016-06-05 16:24:55 +02:00
LemonBoy
72712a0c62 Replace strocpy with g_strlcpy
The only difference was that the former returned 1 if the buffer was
overflown, but the return value was never checked.
2016-06-05 16:24:55 +02:00
LemonBoy
8289f36075 Check the return value of open() in rawlog.c 2016-06-05 16:24:55 +02:00
LemonBoy
bb190be0bf Replace mkpath with g_mkdir_with_parents 2016-06-05 16:24:55 +02:00
ailin-nemui
02221eae37 fix dist compilation failure
remove illegal wcwidth.c include and compile wcwidth.c
correct #include in wcwidth.c
fallout from #480
2016-05-18 16:50:41 +02:00
Xavier G
5d69b4c4a7 Convert string policies from #define to enum. 2016-05-13 17:35:47 +02:00
Xavier G
a26a387545 Adjust some conditions. 2016-05-13 17:31:11 +02:00
Xavier G
f1b5b515b9 Make get_alignment() available outside special-vars.c 2016-05-13 03:51:48 +02:00
Xavier G
97a4ee78fd get_alignment: handle UTF-8 strings.
get_alignment now works with columns (width), not bytes, although it is liable
to work with bytes if the given text is not a valid UTF-8 string.
2016-05-13 03:42:56 +02:00
Xavier G
09ca3ad48f Fix indentation of display_sorted_nicks().
This was done assuming an "indent with tab, align with spaces" approach.
get_alignment also benefited from a minor indentation fix.
2016-05-13 03:31:23 +02:00
Xavier G
719efc44a3 Introduce string_chars_for_width(). 2016-05-13 03:04:08 +02:00
Xavier G
35b3ccc6a4 Introduce string_length() and string_width(). 2016-05-13 02:47:26 +02:00
Xavier G
21c07c0060 Leverage string_policy(). 2016-05-13 02:27:19 +02:00
Xavier G
2c8648a9c8 Introduce string_policy(). 2016-05-13 02:10:02 +02:00
Xavier G
b0afcc96db Rename advance() into string_advance(). 2016-05-13 01:52:37 +02:00
Xavier G
5c74a3bb88 Move advance() from fe-common/core to core. 2016-05-13 01:39:14 +02:00
Xavier G
5538578820 Move utf8.{h,c} from fe-common/core to core. 2016-05-13 01:26:33 +02:00
dequis
2ba4b9d26a net_gethosterror: Handle EAI_SYSTEM ("System error") properly
That error code means "check errno". A few users got it and we never
figured out what happened - it usually fixed itself after restarting
something - so hopefully with this we'll have more information the next
time.
2016-04-07 07:26:19 -03:00
LemonBoy
e5ee243ab6 Simplify some logic in server_create_conn 2016-03-22 15:45:08 +01:00
LemonBoy
6745dd6159 Throw an error when a chatnet has no available url
If you type /connect <CN> and the chatnet <CN> has no url available
let's just throw an error instead of trying to process <CN> as a url.
2016-03-19 14:04:53 +01:00
TheLemonMan
795b7de808 Merge pull request #439 from horgh/ssl-errors
Clear error queue before SSL I/O operations
2016-03-17 22:07:57 +01:00
KindOne
bcebed5a72 Replace spaces with tabs 2016-03-14 21:23:37 -04:00
Jari Matilainen
27c37cb3f3 Return -1 from null-test to comply with the rest of strarray_find 2016-03-14 22:17:17 +01:00
Will Storey
8ab6bdf2ce Add clear error calls to irssi_ssl_get_iochannel 2016-03-13 15:09:52 -07:00
Will Storey
be733d2482 Clear error queue before SSL I/O operations
Otherwise we can see errors that are not related to the operation
we check for. SSL_get_error() inspects the thread's error queue.
See https://www.openssl.org/docs/manmaster/ssl/SSL_get_error.html for
more information.
2016-03-13 13:28:04 -07:00