0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +01:00

Remove the unneeded username parameter to register_local_user().

This commit is contained in:
Jilles Tjoelker 2015-03-06 00:41:51 +01:00
parent 83e5941c87
commit 2125182293
7 changed files with 13 additions and 30 deletions

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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
{

View file

@ -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;

View file

@ -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);
}

View file

@ -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++] = '~';