]> jfr.im git - solanum.git/blobdiff - src/s_user.c
Remove the unneeded username parameter to register_local_user().
[solanum.git] / src / s_user.c
index bc9b0949d00c65912c6c8e4ec7106f8470973f88..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++] = '~';
@@ -435,9 +435,12 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
                else
                {
                        sendto_realops_snomask(SNO_REJ, L_NETWIDE,
-                               "DNSBL listed: %s!%s@%s{%s} %s (%s)", source_p->name,
-                               source_p->username, source_p->host, source_p->sockhost, source_p->info,
-                               source_p->preClient->dnsbl_listed->host);
+                               "Listed on DNSBL %s: %s (%s@%s) [%s] [%s]",
+                               source_p->preClient->dnsbl_listed->host,
+                               source_p->name,
+                               source_p->username, source_p->host,
+                               IsIPSpoof(source_p) ? "255.255.255.255" : source_p->sockhost,
+                               source_p->info);
 
                        rb_dlink_list varlist = { NULL, NULL, 0 };
 
@@ -589,17 +592,16 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
 int
 introduce_client(struct Client *client_p, struct Client *source_p, struct User *user, const char *nick, int use_euid)
 {
-       static char ubuf[12];
+       char ubuf[BUFSIZE];
        struct Client *identifyservice_p;
        char *p;
        hook_data_umode_changed hdata;
        hook_data_client hdata2;
-       char sockhost[HOSTLEN];
 
        if(MyClient(source_p))
-               send_umode(source_p, source_p, 0, 0, ubuf);
+               send_umode(source_p, source_p, 0, ubuf);
        else
-               send_umode(NULL, source_p, 0, 0, ubuf);
+               send_umode(NULL, source_p, 0, ubuf);
 
        if(!*ubuf)
        {
@@ -609,14 +611,6 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User *
 
        s_assert(has_id(source_p));
 
-       if(source_p->sockhost[0] == ':')
-       {
-               sockhost[0] = '0';
-               sockhost[1] = '\0';
-               rb_strlcat(sockhost, source_p->sockhost, sizeof(sockhost));
-       } else
-               strcpy(sockhost, source_p->sockhost);
-
        if (use_euid)
                sendto_server(client_p, NULL, CAP_EUID | CAP_TS6, NOCAPS,
                                ":%s EUID %s %d %ld %s %s %s %s %s %s %s :%s",
@@ -624,7 +618,7 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User *
                                source_p->hopcount + 1,
                                (long) source_p->tsinfo, ubuf,
                                source_p->username, source_p->host,
-                               IsIPSpoof(source_p) ? "0" : sockhost,
+                               IsIPSpoof(source_p) ? "0" : source_p->sockhost,
                                source_p->id,
                                IsDynSpoof(source_p) ? source_p->orighost : "*",
                                EmptyString(source_p->user->suser) ? "*" : source_p->user->suser,
@@ -636,7 +630,7 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User *
                      source_p->hopcount + 1,
                      (long) source_p->tsinfo, ubuf,
                      source_p->username, source_p->host,
-                     IsIPSpoof(source_p) ? "0" : sockhost,
+                     IsIPSpoof(source_p) ? "0" : source_p->sockhost,
                      source_p->id, source_p->info);
 
        if(!EmptyString(source_p->certfp))
@@ -731,6 +725,9 @@ valid_hostname(const char *hostname)
        if(hostname == NULL)
                return NO;
 
+       if(!strcmp(hostname, "localhost"))
+               return YES;
+
        if('.' == *p || ':' == *p || '/' == *p)
                return NO;
 
@@ -1158,7 +1155,7 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
  * -avalon
  */
 void
-send_umode(struct Client *client_p, struct Client *source_p, int old, int sendmask, char *umode_buf)
+send_umode(struct Client *client_p, struct Client *source_p, int old, char *umode_buf)
 {
        int i;
        int flag;
@@ -1219,7 +1216,7 @@ send_umode_out(struct Client *client_p, struct Client *source_p, int old)
        char buf[BUFSIZE];
        rb_dlink_node *ptr;
 
-       send_umode(NULL, source_p, old, 0, buf);
+       send_umode(NULL, source_p, old, buf);
 
        RB_DLINK_FOREACH(ptr, serv_list.head)
        {
@@ -1234,7 +1231,7 @@ send_umode_out(struct Client *client_p, struct Client *source_p, int old)
        }
 
        if(client_p && MyClient(client_p))
-               send_umode(client_p, source_p, old, 0, buf);
+               send_umode(client_p, source_p, old, buf);
 }
 
 /*