]> jfr.im git - solanum.git/commitdiff
Remove the unneeded username parameter to register_local_user().
authorJilles Tjoelker <redacted>
Thu, 5 Mar 2015 23:41:51 +0000 (00:41 +0100)
committerJilles Tjoelker <redacted>
Sun, 13 Sep 2015 20:59:03 +0000 (22:59 +0200)
include/s_user.h
modules/core/m_nick.c
modules/m_cap.c
modules/m_pong.c
modules/m_user.c
src/blacklist.c
src/s_user.c

index 0c39ec5e312dc8a28600d9d4f3d44fc7f1ff48e8..38fa7669bb9921f5c7ca9f1bc1b4ebad691b2ed2 100644 (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);
index 6e36698a5354e5abe661ffba902d394563edb8e5..56f047f989aa2f4113f59f4224444003c495e55b 100644 (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);
        }
 }
 
index b79b792c3b7f8c2815c98750121b4f604dce2265..8556642d9c07f846add1abd3c5ce5871d19b1380 100644 (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);
        }
 }
 
index 5ef65c99f37baad1283b4d898efa7db298e98f57..9de629d3359e1a39b84f5791a34371ec6f8f80b6 100644 (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
                                {
index eece9d8acd1fb356f7e81c0832dbbd077a5d1fae..16fa9fc2d95a71b2b32824e09df320de8304ff43 100644 (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;
index 58dabfb4a85324b1a24570d9aaa0ba420a3a602e..f6f2212790cc312345349e77b7753253c421aec9 100644 (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);
 }
index 0e3c41b5c6e109cc13d081e126a06576d6db7ebe..57b405306ce6753970c54c46fbbd47dd3b2dd232 100644 (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++] = '~';