summaryrefslogtreecommitdiffstats
path: root/src/common/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/server.c')
-rw-r--r--src/common/server.c56
1 files changed, 42 insertions, 14 deletions
diff --git a/src/common/server.c b/src/common/server.c
index 3db0a963..5c645eb5 100644
--- a/src/common/server.c
+++ b/src/common/server.c
@@ -200,13 +200,35 @@ tcp_send_len (server *serv, char *buf, int len)
}
else
{
- /* WHO/MODE get the lowest priority */
- if (g_ascii_strncasecmp (dbuf + 1, "WHO ", 4) == 0 ||
- /* but only MODE queries, not changes */
- (g_ascii_strncasecmp (dbuf + 1, "MODE", 4) == 0 &&
- strchr (dbuf, '-') == NULL &&
- strchr (dbuf, '+') == NULL))
+ /* WHO gets the lowest priority */
+ if (g_ascii_strncasecmp (dbuf + 1, "WHO ", 4) == 0)
dbuf[0] = 0;
+ /* as do MODE queries (but not changes) */
+ else if (g_ascii_strncasecmp (dbuf + 1, "MODE ", 5) == 0)
+ {
+ char *mode_str, *mode_str_end, *loc;
+ /* skip spaces before channel/nickname */
+ for (mode_str = dbuf + 5; *mode_str == ' '; ++mode_str);
+ /* skip over channel/nickname */
+ mode_str = strchr (mode_str, ' ');
+ if (mode_str)
+ {
+ /* skip spaces before mode string */
+ for (; *mode_str == ' '; ++mode_str);
+ /* find spaces after end of mode string */
+ mode_str_end = strchr (mode_str, ' ');
+ /* look for +/- within the mode string */
+ loc = strchr (mode_str, '-');
+ if (loc && (!mode_str_end || loc < mode_str_end))
+ goto keep_priority;
+ loc = strchr (mode_str, '+');
+ if (loc && (!mode_str_end || loc < mode_str_end))
+ goto keep_priority;
+ }
+ dbuf[0] = 0;
+keep_priority:
+ ;
+ }
}
serv->outbound_queue = g_slist_append (serv->outbound_queue, dbuf);
@@ -1094,6 +1116,7 @@ traverse_socks5 (int print_fd, int sok, char *serverAddr, int port)
if (auth)
{
int len_u=0, len_p=0;
+ unsigned char *u_p_buf;
/* authentication sub-negotiation (RFC1929) */
if (buf[1] != 2) /* UPA not supported by server */
@@ -1102,18 +1125,22 @@ traverse_socks5 (int print_fd, int sok, char *serverAddr, int port)
return 1;
}
- memset (buf, 0, sizeof(buf));
-
/* form the UPA request */
len_u = strlen (prefs.hex_net_proxy_user);
len_p = strlen (prefs.hex_net_proxy_pass);
- buf[0] = 1;
- buf[1] = len_u;
- memcpy (buf + 2, prefs.hex_net_proxy_user, len_u);
- buf[2 + len_u] = len_p;
- memcpy (buf + 3 + len_u, prefs.hex_net_proxy_pass, len_p);
- send (sok, buf, 3 + len_u + len_p, 0);
+ packetlen = 2 + len_u + 1 + len_p;
+ u_p_buf = g_malloc0 (packetlen);
+
+ u_p_buf[0] = 1;
+ u_p_buf[1] = len_u;
+ memcpy (u_p_buf + 2, prefs.hex_net_proxy_user, len_u);
+ u_p_buf[2 + len_u] = len_p;
+ memcpy (u_p_buf + 3 + len_u, prefs.hex_net_proxy_pass, len_p);
+
+ send (sok, u_p_buf, packetlen, 0);
+ g_free(u_p_buf);
+
if ( recv (sok, buf, 2, 0) != 2 )
goto read_error;
if ( buf[1] != 0 )
@@ -1757,6 +1784,7 @@ server_set_defaults (server *serv)
serv->have_idmsg = FALSE;
serv->have_accnotify = FALSE;
serv->have_extjoin = FALSE;
+ serv->have_account_tag = FALSE;
serv->have_server_time = FALSE;
serv->have_sasl = FALSE;
serv->have_except = FALSE;