summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2014-01-11 16:08:50 -0500
committerTingPing <tingping@tingping.se>2014-01-11 16:08:50 -0500
commit6e049d59752ff5b7b7d281a9dff2c6df0b3195e5 (patch)
tree8204b24deb143ae466fecb5b872c19ec6428c63c /src
parentb2a780e97aa9edec3d30d13ea17fe39bd8e81553 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/common/outbound.c13
1 files changed, 12 insertions, 1 deletions
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