From f51b72de97b3de37dfed7bf4db36fbb215798aba Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Fri, 13 Feb 2015 23:07:02 +0100 Subject: [PATCH] Ignore duplicate USER and PASS. If SASL starts using USER/PASS for unregistered clients, this change stops users from using one USER/PASS for SASL while using another for connecting. --- modules/m_pass.c | 17 ++--------------- modules/m_user.c | 10 +++++----- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/modules/m_pass.c b/modules/m_pass.c index b4bdf706..e7cc7cd3 100644 --- a/modules/m_pass.c +++ b/modules/m_pass.c @@ -62,21 +62,8 @@ mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char * char *auth_user, *pass, *buf; buf = LOCAL_COPY(parv[1]); - if(client_p->localClient->passwd) - { - memset(client_p->localClient->passwd, 0, - strlen(client_p->localClient->passwd)); - rb_free(client_p->localClient->passwd); - client_p->localClient->passwd = NULL; - } - - if (client_p->localClient->auth_user) - { - memset(client_p->localClient->auth_user, 0, - strlen(client_p->localClient->auth_user)); - rb_free(client_p->localClient->auth_user); - client_p->localClient->auth_user = NULL; - } + if(client_p->localClient->passwd || client_p->localClient->auth_user) + return 0; if ((pass = strchr(buf, ':')) != NULL) { diff --git a/modules/m_user.c b/modules/m_user.c index f258007d..eece9d8a 100644 --- a/modules/m_user.c +++ b/modules/m_user.c @@ -69,6 +69,9 @@ mr_user(struct Client *client_p, struct Client *source_p, int parc, const char * return 0; } + if(source_p->flags & FLAGS_SENTUSER) + return 0; + if((p = strchr(parv[1], '@'))) *p = '\0'; @@ -89,11 +92,8 @@ do_local_user(struct Client *client_p, struct Client *source_p, make_user(source_p); - if (!(source_p->flags & FLAGS_SENTUSER)) - { - lookup_blacklists(source_p); - source_p->flags |= FLAGS_SENTUSER; - } + lookup_blacklists(source_p); + source_p->flags |= FLAGS_SENTUSER; rb_strlcpy(source_p->info, realname, sizeof(source_p->info));