*/
int
-register_local_user(struct Client *client_p, struct Client *source_p, const char *username)
+register_local_user(struct Client *client_p, struct Client *source_p)
{
struct ConfItem *aconf, *xconf;
struct User *user = source_p->user;
s_assert(NULL != source_p);
s_assert(MyConnect(source_p));
- s_assert(source_p->username != username);
if(source_p == NULL)
return -1;
client_p->localClient->last = rb_current_time();
/* XXX - fixme. we shouldnt have to build a users buffer twice.. */
- if(!IsGotId(source_p) && (strchr(username, '[') != NULL))
+ if(!IsGotId(source_p) && (strchr(source_p->username, '[') != NULL))
{
const char *p;
int i = 0;
- p = username;
+ p = source_p->username;
while(*p && i < USERLEN)
{
}
myusername[i] = '\0';
- username = myusername;
}
+ else
+ strlcpy(myusername, source_p->username, sizeof myusername);
- if((status = check_client(client_p, source_p, username)) < 0)
+ if((status = check_client(client_p, source_p, myusername)) < 0)
return (CLIENT_EXITED);
/* Apply nick override */
/* dont replace username if its supposed to be spoofed --fl */
if(!IsConfDoSpoofIp(aconf) || !strchr(aconf->info.name, '@'))
{
- p = username;
+ p = myusername;
if(!IsNoTilde(aconf))
source_p->username[i++] = '~';