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.
This commit is contained in:
Jilles Tjoelker 2015-02-13 23:07:02 +01:00
parent 9299ce1371
commit f51b72de97
2 changed files with 7 additions and 20 deletions

View file

@ -62,21 +62,8 @@ mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *
char *auth_user, *pass, *buf; char *auth_user, *pass, *buf;
buf = LOCAL_COPY(parv[1]); buf = LOCAL_COPY(parv[1]);
if(client_p->localClient->passwd) if(client_p->localClient->passwd || client_p->localClient->auth_user)
{ return 0;
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 ((pass = strchr(buf, ':')) != NULL) if ((pass = strchr(buf, ':')) != NULL)
{ {

View file

@ -69,6 +69,9 @@ mr_user(struct Client *client_p, struct Client *source_p, int parc, const char *
return 0; return 0;
} }
if(source_p->flags & FLAGS_SENTUSER)
return 0;
if((p = strchr(parv[1], '@'))) if((p = strchr(parv[1], '@')))
*p = '\0'; *p = '\0';
@ -89,11 +92,8 @@ do_local_user(struct Client *client_p, struct Client *source_p,
make_user(source_p); make_user(source_p);
if (!(source_p->flags & FLAGS_SENTUSER))
{
lookup_blacklists(source_p); lookup_blacklists(source_p);
source_p->flags |= FLAGS_SENTUSER; source_p->flags |= FLAGS_SENTUSER;
}
rb_strlcpy(source_p->info, realname, sizeof(source_p->info)); rb_strlcpy(source_p->info, realname, sizeof(source_p->info));