From 13b6a40b9c3d1f2215ff87cdaff9e38a4020ee92 Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Sat, 16 Apr 2022 18:41:34 -0500 Subject: Change preferences sub-dialogs to be modal This solves the issue where the parent dialog is closed and then the child dialog is used. This is however only a partial fix: - Many other dialogs throughout the codebase do not currently have parent windows and need to be refactored. - Not all window managers respect modal so users can still trigger bugs. We can be more defensive against this but it requires more refactoring. Closes #2686 --- src/common/fe.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/common') diff --git a/src/common/fe.h b/src/common/fe.h index 9da4e230..b8a6279e 100644 --- a/src/common/fe.h +++ b/src/common/fe.h @@ -141,6 +141,7 @@ void fe_get_int (char *prompt, int def, void *callback, void *ud); #define FRF_NOASKOVERWRITE 32 /* don't ask to overwrite existing files */ #define FRF_EXTENSIONS 64 /* specify file extensions to be displayed */ #define FRF_MIMETYPES 128 /* specify file mimetypes to be displayed */ +#define FRF_MODAL 256 /* dialog should be modal to parent */ void fe_get_file (const char *title, char *initial, void (*callback) (void *userdata, char *file), void *userdata, int flags); -- cgit 1.4.1 From 778047bc65e529804c3342ee0f3a8d5d7550fde5 Mon Sep 17 00:00:00 2001 From: Ashpool Date: Tue, 10 May 2022 03:44:35 +0200 Subject: raise the max length of a server password to 1024 - alleviate #1296 --- src/common/hexchat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/hexchat.h b/src/common/hexchat.h index 43a5f43a..470dd4ad 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -501,7 +501,7 @@ typedef struct server int joindelay_tag; /* waiting before we send JOIN */ char hostname[128]; /* real ip number */ char servername[128]; /* what the server says is its name */ - char password[86]; + char password[1024]; char nick[NICKLEN]; char linebuf[8704]; /* RFC says 512 chars including \r\n, IRCv3 message tags add 8191, plus the NUL byte */ char *last_away_reason; -- cgit 1.4.1 From b8645bfbf21a5f3e4583d7fc97c418585a48624a Mon Sep 17 00:00:00 2001 From: Artem Zhurikhin Date: Fri, 13 May 2022 22:56:26 +0200 Subject: Split long SASL auth strings into 400-byte chunks (#2709) Fixes #2705 --- src/common/inbound.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/inbound.c b/src/common/inbound.c index 3c505a57..ddd6ee9a 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -1929,7 +1929,24 @@ inbound_sasl_authenticate (server *serv, char *data) return; } - tcp_sendf (serv, "AUTHENTICATE %s\r\n", pass); + /* long SASL passwords must be split into 400-byte chunks + https://ircv3.net/specs/extensions/sasl-3.1#the-authenticate-command */ + size_t pass_len = strlen (pass); + if (pass_len <= 400) + tcp_sendf (serv, "AUTHENTICATE %s\r\n", pass); + else + { + size_t sent = 0; + while (sent < pass_len) + { + char *pass_chunk = g_strndup (pass + sent, 400); + tcp_sendf (serv, "AUTHENTICATE %s\r\n", pass_chunk); + sent += 400; + g_free (pass_chunk); + } + } + if (pass_len % 400 == 0) + tcp_sendf (serv, "AUTHENTICATE +\r\n"); g_free (pass); -- cgit 1.4.1 From dfda8f2eeec840bbe5e44b9d7563283ecb10bf10 Mon Sep 17 00:00:00 2001 From: DjLegolas Date: Sat, 14 May 2022 11:20:10 +0300 Subject: fix sysinfo print of cpu name the cpu name might have tailing spaces in Windows, which weren't remove before printing. --- src/common/sysinfo/win32/backend.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/common') diff --git a/src/common/sysinfo/win32/backend.c b/src/common/sysinfo/win32/backend.c index 67a0fd2b..e2ae83ed 100644 --- a/src/common/sysinfo/win32/backend.c +++ b/src/common/sysinfo/win32/backend.c @@ -356,6 +356,8 @@ static char *read_cpu_info (IWbemClassObject *object) VariantClear (&max_clock_speed_variant); + g_strchomp (name_utf8); + if (cpu_freq_mhz > 1000) { result = g_strdup_printf ("%s (%.2fGHz)", name_utf8, cpu_freq_mhz / 1000.f); -- cgit 1.4.1 From ec9653e754f3db754cc24dc7beecae318af3a0fd Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Fri, 15 Jul 2022 13:17:00 -0500 Subject: servlist: Remove IRCHighWay They have self-signed certs which doesn't belong in our default list. --- src/common/servlist.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/common') diff --git a/src/common/servlist.c b/src/common/servlist.c index 160cc9e0..b9b304f8 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -193,9 +193,6 @@ static const struct defaultserver def[] = {"IRC4Fun", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.irc4fun.net"}, - {"IRCHighWay", 0, 0, 0, 0, 0, TRUE}, - {0, "irc.irchighway.net"}, - {"IRCNet", 0}, {0, "open.ircnet.net"}, -- cgit 1.4.1 From d7c6c424e8c078d3e5a28c830ff3f6f62da8b39a Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 1 Aug 2022 14:07:31 -0500 Subject: servlist: Remove ACN They are no longer supporting TLS and let their cert expire. Non-TLS networks do not belong in our default list. Closes #2722 --- src/common/servlist.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/common') diff --git a/src/common/servlist.c b/src/common/servlist.c index b9b304f8..771d7813 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -54,8 +54,6 @@ static const struct defaultserver def[] = /* Invalid hostname in cert */ {0, "irc.2600.net"}, - {"ACN", 0, 0, 0, LOGIN_SASL, 0, TRUE}, - {0, "global.acn.gr"}, {"AfterNET", 0, 0, 0, LOGIN_SASL, 0, TRUE}, {0, "irc.afternet.org"}, -- cgit 1.4.1 From 46c9df18639ff0ee343d4c8ad48e845795b6ac1c Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 28 Aug 2022 17:59:42 +0100 Subject: Fix various compiler warnings. fish.c: -Wincompatible-pointer-types fkeys.c: -Wmisleading-indentation proto-irc.c: -Wincompatible-pointer-types util.c: -Wdeprecated-declarations xtext.c: -Wmaybe-uninitialized --- plugins/fishlim/fish.c | 2 +- src/common/proto-irc.c | 2 +- src/common/util.c | 5 +++++ src/fe-gtk/fkeys.c | 2 +- src/fe-gtk/xtext.c | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/common') diff --git a/plugins/fishlim/fish.c b/plugins/fishlim/fish.c index 5a27e4cb..7fe7e287 100644 --- a/plugins/fishlim/fish.c +++ b/plugins/fishlim/fish.c @@ -91,7 +91,7 @@ static const signed char fish_unbase64[256] = { #include static OSSL_PROVIDER *legacy_provider; static OSSL_PROVIDER *default_provider; -static OSSL_LIB_CTX* *ossl_ctx; +static OSSL_LIB_CTX *ossl_ctx; #endif int fish_init(void) diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 32cc47f2..5b8e02c4 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -461,7 +461,7 @@ channel_date (session *sess, char *chan, char *timestr, } static int -trailing_index(const char *word_eol[]) +trailing_index(char *word_eol[]) { int param_index; for (param_index = 3; param_index < PDIWORDS; ++param_index) diff --git a/src/common/util.c b/src/common/util.c index fa0783d4..f06074fc 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1375,11 +1375,16 @@ str_sha256hash (char *string) int i; unsigned char hash[SHA256_DIGEST_LENGTH]; char buf[SHA256_DIGEST_LENGTH * 2 + 1]; /* 64 digit hash + '\0' */ + +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + SHA256 (string, strlen (string), hash); +#else SHA256_CTX sha256; SHA256_Init (&sha256); SHA256_Update (&sha256, string, strlen (string)); SHA256_Final (hash, &sha256); +#endif for (i = 0; i < SHA256_DIGEST_LENGTH; i++) { diff --git a/src/fe-gtk/fkeys.c b/src/fe-gtk/fkeys.c index dc4b41bc..6dd16e35 100644 --- a/src/fe-gtk/fkeys.c +++ b/src/fe-gtk/fkeys.c @@ -894,7 +894,7 @@ key_save_kbs (void) #define STRIP_WHITESPACE \ while (buf[0] == ' ' || buf[0] == '\t') \ buf++; \ - len = strlen (buf); \ + len = strlen (buf); \ while (buf[len] == ' ' || buf[len] == '\t') \ { \ buf[len] = 0; \ diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index 6a0fccba..08a5110a 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -947,7 +947,7 @@ gtk_xtext_find_char (GtkXText * xtext, int x, int y, int *off, int *out_of_bound textentry *ent; int line; int subline; - int outofbounds; + int outofbounds = FALSE; /* Adjust y value for negative rounding, double to int */ if (y < 0) -- cgit 1.4.1 From 2dbc6adbc23701653e5a32fad42390f461881d7e Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 28 Aug 2022 15:59:40 +0100 Subject: Fix PROTOCTL NAMESX and only send when not using `multi-prefix`. This capability is the equivalent of the old protoctl token. --- src/common/modes.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/common') diff --git a/src/common/modes.c b/src/common/modes.c index 756f0858..d8fd75aa 100644 --- a/src/common/modes.c +++ b/src/common/modes.c @@ -918,8 +918,12 @@ inbound_005 (server * serv, char *word[], const message_tags_data *tags_data) server_set_encoding (serv, "UTF-8"); } else if (g_strcmp0 (tokname, "NAMESX") == 0) { - /* 12345678901234567 */ - tcp_send_len (serv, "PROTOCTL NAMESX\r\n", 17); + if (tokadding && !serv->have_namesx) + { + /* only use protoctl if the server doesn't have the equivalent cap */ + tcp_send_len (serv, "PROTOCTL NAMESX\r\n", 17); + serv->have_namesx = TRUE; + } } else if (g_strcmp0 (tokname, "WHOX") == 0) { serv->have_whox = tokadding; -- cgit 1.4.1 From 8fb0d2311fc249b6b4f6beae7ccd135f913f0e47 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 24 Sep 2022 15:33:20 +0100 Subject: Default /SERVER and friends to use SSL when built with OpenSSL. Since commit 747a52aae8806a9072a23ea68212767f352ac431 users have to opt-out of using SSL when creating a new server. This commit makes it so /SERVER also uses SSL by default. In order to connect insecurely users must now use one of these methods: /SERVER -insecure irc.example.com /SERVER irc.example.com -6667 The `-ssl` flag and the `+port` syntax have been retained for compat reasons. --- src/common/outbound.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/common') diff --git a/src/common/outbound.c b/src/common/outbound.c index 6f0241be..5c4e01b0 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -3249,7 +3249,7 @@ cmd_reconnect (struct session *sess, char *tbuf, char *word[], char *word_eol[]) int offset = 0; #ifdef USE_OPENSSL - int use_ssl = FALSE; + int use_ssl = TRUE; int use_ssl_noverify = FALSE; if (g_strcmp0 (word[2], "-ssl") == 0) { @@ -3261,6 +3261,11 @@ cmd_reconnect (struct session *sess, char *tbuf, char *word[], char *word_eol[]) use_ssl = TRUE; use_ssl_noverify = TRUE; offset++; /* args move up by 1 word */ + } else if (g_strcmp0 (word[2], "-insecure") == 0) + { + use_ssl = FALSE; + use_ssl_noverify = FALSE; + offset++; /* args move up by 1 word */ } serv->use_ssl = use_ssl; serv->accept_invalid_cert = use_ssl_noverify; @@ -3450,8 +3455,10 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[]) char *pass = NULL; char *channel = NULL; char *key = NULL; - int use_ssl = FALSE; +#ifdef USE_OPENSSL + int use_ssl = TRUE; int use_ssl_noverify = FALSE; +#endif int is_url = TRUE; server *serv = sess->server; ircnet *net = NULL; @@ -3469,6 +3476,11 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[]) use_ssl_noverify = TRUE; offset++; /* args move up by 1 word */ } + else if (g_strcmp0 (word[2], "-insecure") == 0) + { + use_ssl = FALSE; + offset++; /* args move up by 1 word */ + } #endif if (!parse_irc_url (word[2 + offset], &server_name, &port, &channel, &key, &use_ssl)) @@ -3509,6 +3521,13 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[]) use_ssl = TRUE; #endif } + else if (port[0] == '-') + { + port++; +#ifdef USE_OPENSSL + use_ssl = FALSE; +#endif + } if (*pass) { @@ -3564,7 +3583,7 @@ cmd_servchan (struct session *sess, char *tbuf, char *word[], int offset = 0; #ifdef USE_OPENSSL - if (g_strcmp0 (word[2], "-ssl") == 0 || g_strcmp0 (word[2], "-ssl-noverify") == 0) + if (g_strcmp0 (word[2], "-ssl") == 0 || g_strcmp0 (word[2], "-ssl-noverify") == 0 || g_strcmp0 (word[2], "-insecure") == 0) offset++; #endif @@ -4098,14 +4117,14 @@ const struct commands xc_cmds[] = { {"SEND", cmd_send, 0, 0, 1, N_("SEND []")}, #ifdef USE_OPENSSL {"SERVCHAN", cmd_servchan, 0, 0, 1, - N_("SERVCHAN [-ssl|-ssl-noverify] , connects and joins a channel")}, + N_("SERVCHAN [-insecure|-ssl|-ssl-noverify] , connects and joins a channel")}, #else {"SERVCHAN", cmd_servchan, 0, 0, 1, N_("SERVCHAN , connects and joins a channel")}, #endif #ifdef USE_OPENSSL {"SERVER", cmd_server, 0, 0, 1, - N_("SERVER [-ssl|-ssl-noverify] [] [], connects to a server, the default port is 6667 for normal connections, and 6697 for ssl connections")}, + N_("SERVER [-insecure|-ssl|-ssl-noverify] [] [], connects to a server, the default port is 6667 for insecure connections, and 6697 for ssl connections")}, #else {"SERVER", cmd_server, 0, 0, 1, N_("SERVER [] [], connects to a server, the default port is 6667")}, -- cgit 1.4.1 From 8cf2aa55863cd34849426e95e2e3e9bccb18eba1 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 16 Oct 2022 11:18:44 +0100 Subject: Make it more clear that /SERVER and /SERVCHAN use SSL by default. --- src/common/outbound.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/common') diff --git a/src/common/outbound.c b/src/common/outbound.c index 5c4e01b0..b9f88196 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -4117,14 +4117,14 @@ const struct commands xc_cmds[] = { {"SEND", cmd_send, 0, 0, 1, N_("SEND []")}, #ifdef USE_OPENSSL {"SERVCHAN", cmd_servchan, 0, 0, 1, - N_("SERVCHAN [-insecure|-ssl|-ssl-noverify] , connects and joins a channel")}, + N_("SERVCHAN [-insecure|-ssl|-ssl-noverify] , connects and joins a channel using ssl unless otherwise specified")}, #else {"SERVCHAN", cmd_servchan, 0, 0, 1, N_("SERVCHAN , connects and joins a channel")}, #endif #ifdef USE_OPENSSL {"SERVER", cmd_server, 0, 0, 1, - N_("SERVER [-insecure|-ssl|-ssl-noverify] [] [], connects to a server, the default port is 6667 for insecure connections, and 6697 for ssl connections")}, + N_("SERVER [-insecure|-ssl|-ssl-noverify] [] [], connects to a server using ssl unless otherwise specified, the default port is 6697 for ssl connections and 6667 for insecure connections")}, #else {"SERVER", cmd_server, 0, 0, 1, N_("SERVER [] [], connects to a server, the default port is 6667")}, -- cgit 1.4.1 From 9d175cc4594d6ccf12b463ab49ec158e9f06036c Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 18 Oct 2022 20:11:18 +0100 Subject: Also request the extended-monitor capability. This allows getting hostname/awaymsg/etc updates for monitored clients which will update the internal cache for that data. --- src/common/inbound.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/common') diff --git a/src/common/inbound.c b/src/common/inbound.c index ddd6ee9a..d4b5a32e 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -1728,6 +1728,7 @@ static const char * const supported_caps[] = { "setname", "invite-notify", "account-tag", + "extended-monitor", /* ZNC */ "znc.in/server-time-iso", -- cgit 1.4.1 From bb7a03e9f68a775ca93dd6ad8ea61e4f1d2ba81b Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 2 Nov 2022 14:35:23 +0000 Subject: Fix updating the topic (user@host) of dialogs on CHGHOST. This is updated when a user receives a new message but would have not been updated when a user sent a CHGHOST. --- src/common/inbound.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/inbound.c b/src/common/inbound.c index d4b5a32e..a591dc48 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -1474,10 +1474,17 @@ inbound_user_info (session *sess, char *chan, char *user, char *host, for (list = sess_list; list; list = list->next) { sess = list->data; - if (sess->type == SESS_CHANNEL && sess->server == serv) + if (sess->server != serv) + continue; + + if (sess->type == SESS_CHANNEL) { userlist_add_hostname (sess, nick, uhost, realname, servname, account, away); } + else if (sess->type == SESS_DIALOG && uhost && !serv->p_cmp (sess->channel, nick)) + { + set_topic (sess, uhost, uhost); + } } } -- cgit 1.4.1