extern void send_umode(struct Client *, struct Client *, int, char *);
extern void send_umode_out(struct Client *, struct Client *, int);
extern int show_lusers(struct Client *source_p);
-extern int register_local_user(struct Client *, struct Client *, const char *);
+extern int register_local_user(struct Client *, struct Client *);
extern int introduce_client(struct Client *client_p, struct Client *source_p,
struct User *user, const char *nick, int use_euid);
static void
set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick)
{
- char buf[USERLEN + 1];
char note[NICKLEN + 10];
/* This had to be copied here to avoid problems.. */
if(source_p->flags & FLAGS_SENTUSER)
{
- rb_strlcpy(buf, source_p->username, sizeof(buf));
-
/* got user, heres nick. */
- register_local_user(client_p, source_p, buf);
-
+ register_local_user(client_p, source_p);
}
}
if(source_p->name[0] && source_p->flags & FLAGS_SENTUSER)
{
- char buf[USERLEN+1];
- rb_strlcpy(buf, source_p->username, sizeof(buf));
- register_local_user(source_p, source_p, buf);
+ register_local_user(source_p, source_p);
}
}
{
if(source_p->localClient->random_ping == incoming_ping)
{
- char buf[USERLEN + 1];
- rb_strlcpy(buf, source_p->username, sizeof(buf));
source_p->flags |= FLAGS_PING_COOKIE;
- register_local_user(client_p, source_p, buf);
+ register_local_user(client_p, source_p);
}
else
{
rb_strlcpy(source_p->info, realname, sizeof(source_p->info));
if(!IsGotId(source_p))
- {
- /* This is in this location for a reason..If there is no identd
- * and ping cookies are enabled..we need to have a copy of this
- */
rb_strlcpy(source_p->username, username, sizeof(source_p->username));
- }
if(source_p->name[0])
{
/* NICK already received, now I have USER... */
- return register_local_user(client_p, source_p, username);
+ return register_local_user(client_p, source_p);
}
return 0;
/* yes, it can probably happen... */
if (rb_dlink_list_length(&blcptr->client_p->preClient->dnsbl_queries) == 0 && blcptr->client_p->flags & FLAGS_SENTUSER && !EmptyString(blcptr->client_p->name))
- {
- char buf[USERLEN + 1];
- rb_strlcpy(buf, blcptr->client_p->username, sizeof buf);
- register_local_user(blcptr->client_p, blcptr->client_p, buf);
- }
+ register_local_user(blcptr->client_p, blcptr->client_p);
rb_free(blcptr);
}
*/
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++] = '~';