diff --git a/include/h.h b/include/h.h index 1499282ad..85513a245 100644 --- a/include/h.h +++ b/include/h.h @@ -686,7 +686,7 @@ extern MODVAR void (*do_mode)(Channel *channel, Client *client, MessageTag *mtag extern MODVAR void (*set_mode)(Channel *channel, Client *cptr, int parc, char *parv[], u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce); extern MODVAR void (*cmd_umode)(Client *, MessageTag *, int, char **); -extern MODVAR int (*register_user)(Client *client, char *nick, char *username, char *umode, char *virthost, char *ip); +extern MODVAR int (*register_user)(Client *client); extern MODVAR int (*tkl_hash)(unsigned int c); extern MODVAR char (*tkl_typetochar)(int type); extern MODVAR int (*tkl_chartotype)(char c); diff --git a/src/api-efunctions.c b/src/api-efunctions.c index add986ff2..5eb8e18ba 100644 --- a/src/api-efunctions.c +++ b/src/api-efunctions.c @@ -41,7 +41,7 @@ void (*do_mode)(Channel *channel, Client *client, MessageTag *mtags, int parc, c void (*set_mode)(Channel *channel, Client *client, int parc, char *parv[], u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce); void (*cmd_umode)(Client *client, MessageTag *mtags, int parc, char *parv[]); -int (*register_user)(Client *client, char *nick, char *username, char *umode, char *virthost, char *ip); +int (*register_user)(Client *client); int (*tkl_hash)(unsigned int c); char (*tkl_typetochar)(int type); int (*tkl_chartotype)(char c); diff --git a/src/modules/authprompt.c b/src/modules/authprompt.c index 7f49ea2a1..aaf738b2a 100644 --- a/src/modules/authprompt.c +++ b/src/modules/authprompt.c @@ -491,7 +491,7 @@ int authprompt_sasl_result(Client *client, int success) /* Authentication was a success */ if (*client->name && client->user && *client->user->username && IsNotSpoof(client)) { - register_user(client, client->name, client->user->username, NULL, NULL, NULL); + register_user(client); /* User MAY be killed now. But since we 'return 1' below, it's safe */ } diff --git a/src/modules/cap.c b/src/modules/cap.c index 3af107f64..97582c0c2 100644 --- a/src/modules/cap.c +++ b/src/modules/cap.c @@ -240,7 +240,7 @@ static void cap_end(Client *client, const char *arg) ClearCapabilityFast(client, CAP_IN_PROGRESS); if (*client->name && client->user && *client->user->username && IsNotSpoof(client)) - register_user(client, client->name, client->user->username, NULL, NULL, NULL); + register_user(client); } static void cap_list(Client *client, const char *arg) diff --git a/src/modules/nick.c b/src/modules/nick.c index b469606ee..ecc945c78 100644 --- a/src/modules/nick.c +++ b/src/modules/nick.c @@ -54,7 +54,7 @@ CMD_FUNC(cmd_nick); CMD_FUNC(cmd_nick_local); CMD_FUNC(cmd_nick_remote); CMD_FUNC(cmd_uid); -int _register_user(Client *client, char *nick, char *username, char *umode, char *virthost, char *ip); +int _register_user(Client *client); void nick_collision(Client *cptr, char *newnick, char *newid, Client *new, Client *existing, int type); int AllowClient(Client *client, char *username); @@ -365,7 +365,7 @@ CMD_FUNC(cmd_nick_local) sendto_one(client, NULL, ":IRC!IRC@%s PRIVMSG %s :\1VERSION\1", me.name, nick); client->lastnick = TStime(); - if (!register_user(client, nick, client->user->username, NULL, NULL, NULL)) + if (!register_user(client)) { if (IsDead(client)) return; @@ -754,7 +754,7 @@ CMD_FUNC(cmd_nick) * @param ip IP address string (can be NULL) * @returns 1 if successfully registered, 0 if not (client might be killed). */ -int _register_user(Client *client, char *nick, char *username, char *umode, char *virthost, char *ip) +int _register_user(Client *client) { ConfigItem_ban *bconf; char *tmpstr; @@ -767,13 +767,10 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char char temp[USERLEN + 1]; char descbuf[BUFSIZE]; - nick = client->name; /* <- The data is always the same, but the pointer is sometimes not, - * I need this for one of my modules, so do not remove! ;) -- Syzop */ - if (!MyConnect(client)) abort(); - if (!AllowClient(client, username)) + if (!AllowClient(client, client->user->username)) { ircstats.is_ref++; /* For safety, we have an extra kill here */ @@ -817,7 +814,7 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char */ /* because username may point to client->user->username */ - strlcpy(temp, username, USERLEN + 1); + strlcpy(temp, client->user->username, USERLEN + 1); if (!IsUseIdent(client)) strlcpy(client->user->username, temp, USERLEN + 1); @@ -950,7 +947,7 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char make_cloakedhost(client, client->user->realhost, client->user->cloakedhost, sizeof(client->user->cloakedhost)); safe_strdup(client->user->virthost, client->user->cloakedhost); - snprintf(descbuf, sizeof descbuf, "Client: %s", nick); + snprintf(descbuf, sizeof descbuf, "Client: %s", client->name); fd_desc(client->local->fd, descbuf); list_move(&client->lclient_node, &lclient_list); @@ -969,7 +966,7 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char log_data_string("extended_client_info", get_connect_extinfo(client))); RunHook2(HOOKTYPE_WELCOME, client, 0); - sendnumeric(client, RPL_WELCOME, NETWORK_NAME, nick, client->user->username, client->user->realhost); + sendnumeric(client, RPL_WELCOME, NETWORK_NAME, client->name, client->user->username, client->user->realhost); RunHook2(HOOKTYPE_WELCOME, client, 1); sendnumeric(client, RPL_YOURHOST, me.name, version); @@ -1032,26 +1029,6 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char if (client->umodes & UMODE_INVISIBLE) irccounts.invisible++; - if (virthost && umode) - { - /* Set the IP address first */ - if (ip && (*ip != '*')) - safe_strdup(client->ip, ip); - - /* For remote clients we recalculate the cloakedhost here because - * it may depend on the IP address (bug #5064). - */ - make_cloakedhost(client, client->user->realhost, client->user->cloakedhost, sizeof(client->user->cloakedhost)); - safe_strdup(client->user->virthost, client->user->cloakedhost); - - /* Set the umodes */ - set_user_modes_dont_spread(client, umode); - - /* Set the vhost */ - if (virthost && *virthost != '*') - safe_strdup(client->user->virthost, virthost); - } - build_umode_string(client, 0, SEND_UMODES|UMODE_SERVNOTICE, buf); sendto_serv_butone_nickcmd(client->direction, client, (*buf == '\0' ? "+" : buf)); diff --git a/src/modules/pingpong.c b/src/modules/pingpong.c index 5adc15e4b..b20e0d2a9 100644 --- a/src/modules/pingpong.c +++ b/src/modules/pingpong.c @@ -147,7 +147,7 @@ CMD_FUNC(cmd_nospoof) me.name, client->name); if (is_handshake_finished(client)) - register_user(client, client->name, client->user->username, NULL, NULL, NULL); + register_user(client); } /* diff --git a/src/modules/user.c b/src/modules/user.c index 84696db7d..6592abc36 100644 --- a/src/modules/user.c +++ b/src/modules/user.c @@ -109,7 +109,7 @@ CMD_FUNC(cmd_user) sendto_one(client, NULL, ":IRC!IRC@%s PRIVMSG %s :\1VERSION\1", me.name, client->name); } - register_user(client, client->name, username, NULL, NULL, NULL); + register_user(client); return; } }