diff --git a/include/s_user.h b/include/s_user.h index 0c39ec5e..38fa7669 100644 --- a/include/s_user.h +++ b/include/s_user.h @@ -41,7 +41,7 @@ extern int user_mode(struct Client *, struct Client *, int, const char **); 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); diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index 6e36698a..56f047f9 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -635,7 +635,6 @@ clean_uid(const char *uid, const char *sid) 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.. */ @@ -651,11 +650,8 @@ set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick) 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); } } diff --git a/modules/m_cap.c b/modules/m_cap.c index b79b792c..8556642d 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -317,9 +317,7 @@ cap_end(struct Client *source_p, const char *arg) 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); } } diff --git a/modules/m_pong.c b/modules/m_pong.c index 5ef65c99..9de629d3 100644 --- a/modules/m_pong.c +++ b/modules/m_pong.c @@ -110,10 +110,8 @@ mr_pong(struct Client *client_p, struct Client *source_p, int parc, const char * { 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 { diff --git a/modules/m_user.c b/modules/m_user.c index eece9d8a..16fa9fc2 100644 --- a/modules/m_user.c +++ b/modules/m_user.c @@ -98,17 +98,12 @@ do_local_user(struct Client *client_p, struct Client *source_p, 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; diff --git a/src/blacklist.c b/src/blacklist.c index 58dabfb4..f6f22127 100644 --- a/src/blacklist.c +++ b/src/blacklist.c @@ -153,11 +153,7 @@ static void blacklist_dns_callback(void *vptr, struct DNSReply *reply) /* 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); } diff --git a/src/s_user.c b/src/s_user.c index 0e3c41b5..57b40530 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -219,7 +219,7 @@ show_lusers(struct Client *source_p) */ 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; @@ -230,7 +230,6 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char s_assert(NULL != source_p); s_assert(MyConnect(source_p)); - s_assert(source_p->username != username); if(source_p == NULL) return -1; @@ -265,12 +264,12 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char 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) { @@ -280,10 +279,11 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char } 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 */ @@ -339,7 +339,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char /* 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++] = '~';