From abad2c5da669df37a59a14da9e2423f59818ac2e Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 12 Jan 2016 05:54:04 -0600 Subject: [PATCH] CONNECT: allow using 3-argument CONNECT with port == 0 locally (closes #119) --- modules/m_connect.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/m_connect.c b/modules/m_connect.c index 59919052..6edd210c 100644 --- a/modules/m_connect.c +++ b/modules/m_connect.c @@ -110,20 +110,17 @@ mo_connect(struct Client *client_p, struct Client *source_p, int parc, const cha * use the default form configuration structure. If missing * from there, then use the precompiled default. */ - tmpport = port = server_p->port; + tmpport = port = 0; if(parc > 2 && !EmptyString(parv[2])) + port = atoi(parv[2]); + if(port == 0 && server_p->port) + port = server_p->port; + else if(port <= 0) { - if((port = atoi(parv[2])) <= 0) - { - sendto_one_notice(source_p, ":Connect: Illegal port number"); - return 0; - } - } - else if(port <= 0 && (port = PORTNUM) <= 0) - { - sendto_one_notice(source_p, ":Connect: missing port number"); + sendto_one_notice(source_p, ":Connect: illegal port number"); return 0; } + /* * Notify all operators about remote connect requests */