From 6e049d59752ff5b7b7d281a9dff2c6df0b3195e5 Mon Sep 17 00:00:00 2001 From: TingPing Date: Sat, 11 Jan 2014 16:08:50 -0500 Subject: Login when /server is used on known hostname This brings back old behavior where you can /server to another server in the same network and login with services but now is only sent when the server is known not every time so more secure. --- src/common/outbound.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/common/outbound.c b/src/common/outbound.c index 7d64e65f..5047bfcd 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -3336,6 +3336,7 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[]) int use_ssl = FALSE; int is_url = TRUE; server *serv = sess->server; + ircnet *net = NULL; #ifdef USE_OPENSSL /* BitchX uses -ssl, mIRC uses -e, let's support both */ @@ -3392,7 +3393,17 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[]) } else { - serv->password[0] = 0; + /* If part of a known network, login like normal */ + net = servlist_net_find_from_server (server_name); + if (net) + { + safe_strcpy (serv->password, net->pass, sizeof (serv->password)); + serv->loginmethod = net->logintype; + } + else /* Otherwise ensure no password is sent */ + { + serv->password[0] = 0; + } } #ifdef USE_OPENSSL -- cgit 1.4.1