]> jfr.im git - solanum.git/blobdiff - ircd/s_user.c
ircd: attach_conf: avoid clang static analysis warning
[solanum.git] / ircd / s_user.c
index 18104c6a649a07fc36912a2bf3c5286118645d79..c7e64161c45f9febccc4b4b2f70a7e687adc66d2 100644 (file)
@@ -218,8 +218,9 @@ authd_check(struct Client *client_p, struct Client *source_p)
                        struct BlacklistStats *stats;
                        char *blacklist = source_p->preClient->auth.data;
 
-                       if((stats = rb_dictionary_retrieve(bl_stats, blacklist)) != NULL)
-                               stats->hits++;
+                       if(bl_stats != NULL)
+                               if((stats = rb_dictionary_retrieve(bl_stats, blacklist)) != NULL)
+                                       stats->hits++;
 
                        if(IsExemptKline(source_p) || IsConfExemptDNSBL(aconf))
                        {
@@ -347,7 +348,6 @@ int
 register_local_user(struct Client *client_p, struct Client *source_p)
 {
        struct ConfItem *aconf, *xconf;
-       struct User *user = source_p->user;
        char tmpstr2[BUFSIZE];
        char ipaddr[HOSTIPLEN];
        char myusername[USERLEN+1];
@@ -366,9 +366,9 @@ register_local_user(struct Client *client_p, struct Client *source_p)
        {
                if(!(source_p->flags & FLAGS_PINGSENT) && source_p->localClient->random_ping == 0)
                {
-                       source_p->localClient->random_ping = (unsigned long) (rand() * rand()) << 1;
-                       sendto_one(source_p, "PING :%08lX",
-                                  (unsigned long) source_p->localClient->random_ping);
+                       source_p->localClient->random_ping = (uint32_t)(((rand() * rand()) << 1) | 1);
+                       sendto_one(source_p, "PING :%08X",
+                                  (unsigned int) source_p->localClient->random_ping);
                        source_p->flags |= FLAGS_PINGSENT;
                        return -1;
                }
@@ -479,7 +479,7 @@ register_local_user(struct Client *client_p, struct Client *source_p)
                }
        }
 
-       if(IsNeedSasl(aconf) && !*user->suser)
+       if(IsNeedSasl(aconf) && !*source_p->user->suser)
        {
                ServerStats.is_ref++;
                sendto_one_notice(source_p, ":*** Notice -- You need to identify via SASL to use this server");
@@ -620,7 +620,7 @@ register_local_user(struct Client *client_p, struct Client *source_p)
         */
        if(!*source_p->id)
        {
-               strcpy(source_p->id, generate_uid());
+               rb_strlcpy(source_p->id, generate_uid(), sizeof(source_p->id));
                add_to_id_hash(source_p->id, source_p);
        }
 
@@ -664,7 +664,7 @@ register_local_user(struct Client *client_p, struct Client *source_p)
 
        free_pre_client(source_p);
 
-       introduce_client(client_p, source_p, user, source_p->name, 1);
+       introduce_client(client_p, source_p, source_p->user, source_p->name, 1);
        return 0;
 }
 
@@ -1476,17 +1476,14 @@ construct_umodebuf(void)
                        if (user_modes[i] == 0)
                        {
                                orphaned_umodes |= prev_user_modes[i];
-                               sendto_realops_snomask(SNO_DEBUG, L_ALL, "Umode +%c is now orphaned", i);
+                               user_modes[i] = prev_user_modes[i];
                        }
                        else
-                       {
                                orphaned_umodes &= ~prev_user_modes[i];
-                               sendto_realops_snomask(SNO_DEBUG, L_ALL, "Orphaned umode +%c is picked up by module", i);
-                       }
-                       user_modes[i] = prev_user_modes[i];
                }
                else
                        prev_user_modes[i] = user_modes[i];
+
                if (user_modes[i])
                        *ptr++ = (char) i;
        }