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.
This commit is contained in:
TingPing 2014-01-11 16:08:50 -05:00
parent b2a780e97a
commit 6e049d5975

View File

@ -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