X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/21c9d815d7293b2fa7e531e8f9f69db2e3399554..ac408af6cba5a230c66186d4389e60766c3a74a4:/modules/m_pass.c diff --git a/modules/m_pass.c b/modules/m_pass.c index 3f178e4..5f59f95 100644 --- a/modules/m_pass.c +++ b/modules/m_pass.c @@ -26,7 +26,7 @@ #include "stdinc.h" #include "client.h" /* client struct */ -#include "irc_string.h" +#include "match.h" #include "send.h" /* sendto_one */ #include "numeric.h" /* ERR_xxx */ #include "ircd.h" /* me */ @@ -52,7 +52,6 @@ DECLARE_MODULE_AV1(pass, NULL, NULL, pass_clist, NULL, NULL, "$Revision: 3550 $" * * * mr_pass - PASS message handler - * parv[0] = sender prefix * parv[1] = password * parv[2] = "TS" if this server supports TS. * parv[3] = optional TS version field -- needed for TS6 @@ -60,6 +59,9 @@ DECLARE_MODULE_AV1(pass, NULL, NULL, pass_clist, NULL, NULL, "$Revision: 3550 $" static int mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { + char *auth_user, *pass, *buf; + buf = LOCAL_COPY(parv[1]); + if(client_p->localClient->passwd) { memset(client_p->localClient->passwd, 0, @@ -67,7 +69,23 @@ mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char * rb_free(client_p->localClient->passwd); } - DupNString(client_p->localClient->passwd, parv[1], PASSWDLEN); + client_p->localClient->passwd = rb_strndup(parv[1], PASSWDLEN); + + if ((pass = strchr(buf, ':')) != NULL) + { + *pass++ = '\0'; + auth_user = buf; + } + else + { + pass = buf; + auth_user = NULL; + } + + client_p->localClient->passwd = *pass ? rb_strndup(pass, PASSWDLEN) : NULL; + + if(auth_user && *auth_user) + client_p->localClient->auth_user = rb_strndup(auth_user, PASSWDLEN); /* These are for servers only */ if(parc > 2 && client_p->user == NULL)