src/s_user: Make UID assignment happen once we know it's a valid user

This commit is contained in:
Sam Dodrill 2014-01-29 21:14:09 -08:00
parent 177241882c
commit 55147df5de
1 changed files with 9 additions and 9 deletions

View File

@ -234,6 +234,15 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
if(IsAnyDead(source_p)) if(IsAnyDead(source_p))
return -1; return -1;
/* Allocate a UID if it was not previously allocated.
* If this already occured, it was probably during SASL auth...
*/
if(!*source_p->id)
{
strcpy(source_p->id, generate_uid());
add_to_id_hash(source_p->id, source_p);
}
if(ConfigFileEntry.ping_cookie) if(ConfigFileEntry.ping_cookie)
{ {
if(!(source_p->flags & FLAGS_PINGSENT) && source_p->localClient->random_ping == 0) if(!(source_p->flags & FLAGS_PINGSENT) && source_p->localClient->random_ping == 0)
@ -534,15 +543,6 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
add_to_hostname_hash(source_p->orighost, source_p); add_to_hostname_hash(source_p->orighost, source_p);
/* Allocate a UID if it was not previously allocated.
* If this already occured, it was probably during SASL auth...
*/
if(!*source_p->id)
{
strcpy(source_p->id, generate_uid());
add_to_id_hash(source_p->id, source_p);
}
if (IsSSL(source_p)) if (IsSSL(source_p))
source_p->umodes |= UMODE_SSLCLIENT; source_p->umodes |= UMODE_SSLCLIENT;