Fix handling of multiple NICK's before a USER
We have to release the old nickname _first_, so that we can register the same one again (albeit with a slight race condition).
This commit is contained in:
parent
b1780e3efb
commit
081b9f6bd2
10
src/kike.c
10
src/kike.c
@ -638,16 +638,16 @@ irc_handle_nick (const struct irc_message *msg, struct client *c)
|
||||
irc_send_reply (c, IRC_ERR_ERRONEOUSNICKNAME, nickname);
|
||||
return;
|
||||
}
|
||||
if (str_map_find (&ctx->users, nickname))
|
||||
{
|
||||
irc_send_reply (c, IRC_ERR_NICKNAMEINUSE, nickname);
|
||||
return;
|
||||
}
|
||||
if (c->nickname)
|
||||
{
|
||||
str_map_set (&ctx->users, c->nickname, NULL);
|
||||
free (c->nickname);
|
||||
}
|
||||
if (str_map_find (&ctx->users, nickname))
|
||||
{
|
||||
irc_send_reply (c, IRC_ERR_NICKNAMEINUSE, nickname);
|
||||
return;
|
||||
}
|
||||
|
||||
// Allocate the nickname
|
||||
c->nickname = xstrdup (nickname);
|
||||
|
Loading…
Reference in New Issue
Block a user